RPC HELP Mult Order

From VistApedia
Jump to: navigation, search

RPC Broker Help Home

Order Method



Applies to

TMult Class


   function Order(const StartSubscript: string; Direction: integer): string;


The Order method works very similar to the $ORDER function in M. Using the Order method you can traverse through the list of elements in the Mult property of an RPC parameter.

The StartSubscript parameter is the subscript of the element whose next or previous sibling will be returned. If the Direction parameter is a positive number, then the subscript of the following element will be returned, while if it’s 0 or negative, then the predecessor’s subscript will be returned. If the list is empty or there are no more elements beyond the StartSubscript parameter, then empty string will be returned. You can use the empty string as a StartSubscript parameter, then, depending on the Direction parameter, you will get the subscript of the first or the last element in the list.

There are some important differences between this method and the $ORDER function in M. Unlike the $ORDER function, the Order method requires both parameters to be passed in. If the StartSubscript parameter is not an empty string, it must be equal to one of the subscripts in the list, otherwise an empty string will be returned. It is case-sensitive. Unlike arrays in M, elements in TMult may or may not be in alphabetical order, depending on the Sorted property, so Order may not return the next or previous subscript in collating sequence.

See RPC Limits for information about the size of parameters and results that can be passed to and returned from the TMult class