xsharp.eu • ASort with codeblock
Page 1 of 1

ASort with codeblock

Posted: Thu Mar 12, 2020 9:03 am
by Kees Bouw
Hi,

With ASort() I use a codeblock that is defined as an object of a custom class with an Eval() method, like this:

LOCAL cbSort AS ItemSort

(ItemSort is defined like this:
CLASS ItemSort
PROTECT dwColumn AS DWORD
PROTECT dwMissing AS DWORD
METHOD Eval(a, b)
// code that compares a and b and RETURN's a logic.)

cbSort := ItemSort{dwSort, dwNoshow}

aMatrix := ASort(aMatrix, , , cbSort)

In VO this worked fine, but in X# I get a runtime error at XSharp.RT.Functions.ASort(__Array aTarget, __Usual nStart, __Usual nCount, __Usual cbOrder)
ArgNum :4
FuncSym :ASort
Severity :2
Description :Argument error
SubCodeText :Unknown SubCode
Arg :cbOrder

Any ideas how to fix this?

Kees.

ASort with codeblock

Posted: Thu Mar 12, 2020 9:23 am
by robert
Kees,

It looks like we have forgotten to implement that.
You should be able to work around this by changing your ASort() line to:

Code: Select all

aMatrix := ASort(aMatrix, , , {|a,b| cbSort:Eval(a,b) })
This should also work in VO by the way.

Robert

ASort with codeblock

Posted: Thu Mar 12, 2020 10:10 am
by Kees Bouw
robert wrote:Kees,
You should be able to work around this by changing your ASort() line to:

Code: Select all

aMatrix := ASort(aMatrix, , , {|a,b| cbSort:Eval(a,b) })
Robert,

Thank you very much, this works!

Kees.