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?
PB5.20b1 - SortStructuredArray throws an error
-
- Enthusiast
- Posts: 276
- Joined: Fri Apr 25, 2003 5:06 pm
- Location: Gummersbach - Germany
- Contact:
PB5.20b1 - SortStructuredArray throws an error
The Human Code Machine / Masters' Design Group
Re: PB5.20b1 - SortStructuredArray throws an error
The 'Sort' types now match the variable types. So #PB_Sort_Long would be replaced by #PB_Long.
@Edit: corrected a silly typo.
@Edit: corrected a silly typo.
Last edited by Demivec on Thu Jun 20, 2013 3:27 pm, edited 1 time in total.
-
- Enthusiast
- Posts: 276
- Joined: Fri Apr 25, 2003 5:06 pm
- Location: Gummersbach - Germany
- Contact:
Re: PB5.20b1 - SortStructuredArray throws an error
Thx, this works fine!
The Human Code Machine / Masters' Design Group
Re: PB5.20b1 - SortStructuredArray throws an error
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!
-
- Enthusiast
- Posts: 276
- Joined: Fri Apr 25, 2003 5:06 pm
- Location: Gummersbach - Germany
- Contact:
Re: PB5.20b1 - SortStructuredArray throws an error
Maybe, but the source compiles with 5.11 without errors...
The Human Code Machine / Masters' Design Group
-
- Addict
- Posts: 4775
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: PB5.20b1 - SortStructuredArray throws an error
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:
This macro also shows how calling the built-in PB functions SortStructuredArray() and SortStructuredList() could be simplified.

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)
Re: PB5.20b1 - SortStructuredArray throws an error
@Little John
Great idea!
Great idea!
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
-
- Enthusiast
- Posts: 276
- Joined: Fri Apr 25, 2003 5:06 pm
- Location: Gummersbach - Germany
- Contact:
Re: PB5.20b1 - SortStructuredArray throws an error
Nice one!
The Human Code Machine / Masters' Design Group