PB5.20b1 - SortStructuredArray throws an error

Just starting out? Need help? Post your questions and find answers here.
THCM
Enthusiast
Enthusiast
Posts: 276
Joined: Fri Apr 25, 2003 5:06 pm
Location: Gummersbach - Germany
Contact:

PB5.20b1 - SortStructuredArray throws an error

Post by THCM »

SortStructuredArray(PeriodsUsage(), #PB_Sort_Descending, OffsetOf(PeriodStats\PeriodCount), #PB_Sort_Long)

The compiler stops with constant not found error: #PB_Sort_Long and the autocomplete funtion of the IDE only suggests #PB_Sort_Long as #PB_Sort_ type. Perhaps something has changed here?
The Human Code Machine / Masters' Design Group
User avatar
Demivec
Addict
Addict
Posts: 4259
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: PB5.20b1 - SortStructuredArray throws an error

Post by Demivec »

The 'Sort' types now match the variable types. So #PB_Sort_Long would be replaced by #PB_Long.


@Edit: corrected a silly typo.
Last edited by Demivec on Thu Jun 20, 2013 3:27 pm, edited 1 time in total.
THCM
Enthusiast
Enthusiast
Posts: 276
Joined: Fri Apr 25, 2003 5:06 pm
Location: Gummersbach - Germany
Contact:

Re: PB5.20b1 - SortStructuredArray throws an error

Post by THCM »

Thx, this works fine!
The Human Code Machine / Masters' Design Group
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: PB5.20b1 - SortStructuredArray throws an error

Post by c4s »

This has already changed in PB 5.10 ;)
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
THCM
Enthusiast
Enthusiast
Posts: 276
Joined: Fri Apr 25, 2003 5:06 pm
Location: Gummersbach - Germany
Contact:

Re: PB5.20b1 - SortStructuredArray throws an error

Post by THCM »

Maybe, but the source compiles with 5.11 without errors...
The Human Code Machine / Masters' Design Group
Little John
Addict
Addict
Posts: 4775
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: PB5.20b1 - SortStructuredArray throws an error

Post by Little John »

In newer PB versions, it's not necessary at all to use those type constants. TypeOf() does the job. :-)

Actually, normally I'm using a macro like this:

Code: Select all

Macro SortStructuredArraySimple (_ArrayName_, _Options_, _Structure_Field_)
   SortStructuredArray(_ArrayName_, _Options_, OffsetOf(_Structure_Field_), TypeOf(_Structure_Field_))
EndMacro

SortStructuredArraySimple(PeriodsUsage(), #PB_Sort_Descending, PeriodStats\PeriodCount)
This macro also shows how calling the built-in PB functions SortStructuredArray() and SortStructuredList() could be simplified.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: PB5.20b1 - SortStructuredArray throws an error

Post by c4s »

@Little John
Great idea!
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
THCM
Enthusiast
Enthusiast
Posts: 276
Joined: Fri Apr 25, 2003 5:06 pm
Location: Gummersbach - Germany
Contact:

Re: PB5.20b1 - SortStructuredArray throws an error

Post by THCM »

Nice one!
The Human Code Machine / Masters' Design Group
Post Reply