Sort Method (DATATABLE)


10.5, PLBCMP GUI Only

 

The Sort method orders the DATATABLE rows based on the values in one to four columns. The method uses the following format:

 

[label]

{object}.Sort

[GIVING {return}] USING [*Col=]{column}][:

 

 

[*Type=]{type}][:

 

 

[*Mask=]{mask}][:

 

 

[*Col1=]{column1}][:

 

 

[*Type1=]{type1}][:

 

 

[*Mask1=]{mask1}][:

 

 

[*Col2=]{column2}][:

 

 

[*Type2=]{type2}][:

 

 

[*Mask2=]{mask2}][:

 

 

[*Col3=]{column3}][:

 

 

[*Type3=]{type3}][:

 

 

[*Mask1=]{mask3}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A DATATABLE object.

return

Optional. A Numeric Variable that indicates the success or failure of the method.

column

Required. A decimal number or Numeric Variable that specifies the zero-based column that is sorted.

type

Required. A decimal number or Numeric Variable that specifies the type of sort.

mask

Optional. A Character String Variable or literal that specifies a date or time mask.

column1 - column3

Optional. A decimal number or Numeric Variable that specifies the zero-based column that is sorted.

type1 - type3

Optional. A decimal number or Numeric Variable that specifies the type of sort.

mask1 - mask3

Optional. A Character String Variable or literal that specifies a date or time mask.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The EOS flag is always cleared.

  2. A zero is returned for success or a value of one for failure.

  3. The ZERO flag is set if the {return} value is zero.

  4. The OVER flag is set if the {return} variable is too small to receive the return value.

  5. The {type} must be one of the following:

  6.  

    Value

    Sort Type

    0

    column ignored

    1

    alpha ascending

    2

    alpha descending

    3

    numeric ascending

    4

    numeric descending

    5

    date ascending

    6

    date descending

    7

    time ascending

    8

    time descending

    9

    timestamp ascending

    10

    timestamp descending

     

  7. When a value of zero is specified for {type}, the associated sort column is ignored and not included in the sort process. A failure return value is given when a valid (non-zero) value is not specified for at least one sort column.

  8. A date mask value contains dd for day, mm for month, yy or yyyy for year. The default mask is "mm-dd-yy".

  9. A date mask specified as 'm/d/yy' allows dates that include either 1 or 2 character digits for the month or day to be sorted correctly.

  10.  

    Examples of Data using 'm/d/yy' date mask:

     

     

    Unsorted

    Sprted Ascending

     6/15/13

    1/3/13

     6/5/13

    6/1/13

    6/1/13

    6/5/13

    10/20/13

    6/15/13

    6/25/13

    6/25/13

    1/3/13

    10/20/13

     

  11. A time mask value contains hh for hour, mm for minute, ss for seconds, and xx for 100th of a second. The default mask is hh:mm:ss.xx.

  12. A timestamp mask value contains DD for day, MM for month, YY or YYYY for year, hh for hour, mm for minute, ss for seconds, and xx for 100th of a second. The default mask is YYYYMMDDhhmmssxx.

 

 

See Also: Method Syntax, DATATABLE Methods

 



PL/B Language Reference SetRowTextAll Method (DATATABLE) HtmlUnbind Method (DATATABLE)