NV(), NS() |
|
|
The NV() function returns a dynamic array containing ascending value position numbers corresponding to a supplied dynamic array. The NS() function is similar for subvalues.
Format
NV(string {, repeat}) NS(string)
where
The NV() and NS() functions are intended for use in I-type expressions but can be used in QMBasic programs.
The NV() function takes a dynamic array as its argument and returns a dynamic array where each value in the input array is replaced by its value position number. If the supplied string contains subvalues, the repeat argument determines how the function behaves. If this is True, the returned data will contain the value position for each subvalue in string. If it is False or omitted, subvalues are ignored, inserting just one value position number for each value.
The NS() function takes a dynamic array as its argument and returns a dynamic array where each subvalue in the input array is replaced by its subvalue position number.
Examples
S = 111VM121SM122SM123VM131SM132FM211SM212VM221
The example below is based on the QM demonstration sales database and assumes that an I-type item named LINE.NO has been created as: 1: I 2: NV(ITEM) 3: 4: Line 5: 2R 6: M 7: LINE
A query LIST SALES DATE CUST LINE.NO ITEM QTY might produce a report containing
SALES..... Date..... Cust Line Item Qty 12140 14 Oct 07 1056 1 003 1 2 122 3 3 234 2 4 121 6 12347 07 Feb 08 1087 1 004 1 2 131 3 3 232 1 4 055 1 5 021 6 |