pralash
22nd November 2017, 12:37
Hi,
I'm new for LN programming... I want to know that there is any predefined LN functions are available for sorting a one dimensional array in ascending or descending order. If it is possible one, please let me know....
Thanks in advance,
Regards,
Pralash
srprks
22nd November 2017, 13:22
Hi,
I'm new for LN programming... I want to know that there is any predefined LN functions are available for sorting a one dimensional array in ascending or descending order. If it is possible one, please let me know....
Thanks in advance,
Regards,
Pralash
Searching and sorting data overview and synopsis
Overview
Use these functions for searching and sorting data. Use qss.search() to search the data for a particular value. Use qss.sort() to sort the data. The data can be a string or an array of type string, long, or double.
The qss.search() function can perform either a linear or a binary search. A binary search is faster than a linear search, but the data must first be sorted by qss.sort(). In practice, therefore, a binary search is efficient only when the data does not often change and so does not require repeated sorting. If the data is frequently modified, use a linear search on unsorted data instead; this avoids frequent calls to qss.sort().
Synopsis
long
qss.search() ( long flag, void search, ref void array, ref long def [, long dept] )
long
qss.sort() ( ref void array, ref long def [, long dept] )
pralash
23rd November 2017, 08:56
I have an array such as count(10)... Every index has different integer values.... I want to sorting this array in ascending order... Can you please tell me the sample script for how to sort this array by using "qss.sort" function...
Thanks,
Regards,
Pralash
bdittmar
23rd November 2017, 10:05
Hello,
qss.sort()
Syntax:
function long qss.sort (ref void array, ref long def, long dept)
Description
This function performs a fast sort of a specified array.
Note that the order in the result array of two elements that compare identical is unpredictable.
Arguments
ref void array The name of the array to be sorted.
ref long def This determines how the array is to be sorted. The argument must be declared as follows:
long def(x,4) | x is the number of sort fields
You can define several sort fields (1 to x ). When performing a sort, the system sorts on the first sort field. Then, if there are duplicate values in the first sort field, the system sorts on the second sort field, and so on.
For each sort field, you define the four sort properties by using the following functions. In each case, the field_number argument specifies the sequence number (1 to x ) of the sort field.
void qss.start( ref long def, long field_number, long position ) This specifies the start position of the sort field in the array elements.
void qss.way( ref long def, long field_number, long way ) This defines the sort order. The argument way can be set to QSS.UP (ascending sort) or QSS.DOWN (descending sort).
void qss.type( ref long def, long field_number, long type ) This specifies the sort field's type, for example. DB.LONG, DB.DOUBLE, DB.STRING, DB.DATE, and so on.
void qss.length( ref long def, long search_condition, long length ) This specifies the length of the sort field. This option is valid only when sorting strings.If you define fewer sort fields than you have declared, you must close the def argument by calling qss.start() with a start position of zero. For example, if you have declared three sort fields, as follows:def(3,4)but then create only two sort fields, you must close the definition with the following call:qss.start(def,3,0)
long dept This indicates the number of array elements to be sorted if the function is not intended to sort the entire array. By default, the function sorts the entire array.
Return values
0 success
-1 error
-11 def is not of type long array or array not of type array
-13 dept must be positive
-14 def argument not correctly declared
-16 QSS.TYPE not correct
-17 array argument not correct
-18 no definition found in def
Have you seen ?
http://www.baanboard.com/programmers_manual_baanerp
pralash
23rd November 2017, 11:53
Thanks for your information...
Will refer the URL as you suggested...
Regards,
Pralash