ASort with codeblock

We encourage new members to introduce themselves here. Get to know one another and share your interests.
Post Reply
User avatar
Kees Bouw
Posts: 124
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

ASort with codeblock

Post 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.
User avatar
robert
Posts: 4553
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

ASort with codeblock

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Kees Bouw
Posts: 124
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

ASort with codeblock

Post 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.
Post Reply