Go Back > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor


Google search

For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
Installation Wizard into new VRC
Manual into existing VRC
Manual into new VRC
Total votes: 39

Baanboard at LinkedIn

Reference Content

Thread Tools Display Modes
Old 25th January 2017, 12:17
VishalMistry's Avatar
VishalMistry VishalMistry is offline
Join Date: Dec 2004
Location: India, Gujarat
Posts: 580
VishalMistry has a little shameless behaviour in the past
Baan: Baan IV, ERPLn - DB: SQL Server 2000 / 2008 - OS: Windows Server 2003 / 2008
Red face purpose of qss.start
Baan: Baan IVc4
C/S: Both

hello everyone,

I just came to know about qss.* series of functions.

Can anybody explain with a short example, what is the purpose of followig qss functions:

qss.start (this is not present even in baan manual)

thanks in advance,

Reply With Quote
Old 25th January 2017, 12:24
bdittmar's Avatar
bdittmar bdittmar is offline
Join Date: Apr 2002
Location: Germany, 50.584097,8.544078
Posts: 1,683
bdittmar will become famous soon enough
Baan: 2.2/3.1/4c4/LN6.1 FP6/FP9/HiDox - DB: tbase, ms-sql7, oracle10gV1, 11g - OS: HP-UX, W2K3, SLES

from DEV-Guide !
BaanERP Programmers Guide

Send feedback about the online Help to Baan Development


long long flag, void search, ref void tbl, ref long def [, long dept] )

This searches a specified array for a particular value, which is referred to as the search key. By default, it reads the array sequentially until it finds the specified value (that is, it performs a linear search). To perform a binary search instead, you must first sort the data with qss.sort() and then call with the flag argument set to QSS.SRC.IS.SORTED. 

 This specifies which array element is to be retrieved and the type of search to be performed. You can set the argument to one of the following possible values:

QSS.FIRST    Find the first record in the array; the search argument is ignored.
QSS.LAST      Find the last record in the array; the search argument is ignored.
QSS.GT          Find the first record greater than the search key.
QSS.GTEQ    Find the first record greater than or equal to the search key. 
QSS.LESS     Find the first record less than the search key.
QSS.EQLE     Find the first record less than or equal to the search key. 
QSS.EQUAL   Find the first record equal to the search key.
QSS.NE          Find the first record not equal to the search key.

You can combine each of these options with one or more of the following options:
 Specifies a binary search. The array must previously have been sorted by using qss.sort().
 When this flag is set, the function searches the array for a specified record pattern – that is, it searches for an array element that matches both the structure and value of the search key. The search argument must have the same layout and length as the elements in tbl. 

When this flag is not set, the search argument is constructed as the concatenation of the key fields defined by the def argument (see Example 2).
 Specifies that the search key can occur more than once in the source array.
 The value that you want to search for in the specified array. This is the search key.
 This specifies the array that must be searched. It can be a string or an array of type string, long, or double, but it is usually an array of strings.
 This indicates how the system is to search the array and against what conditions it must test the elements of the array.  The argument must be declared as follows:

long def(x,4) | x is the number of search fields

You can define several search fields (1 to x). For each search field, you define the four search properties by using the following functions. In each case, the field_number argument specifies the sequence number (1 to x) of the search field.

void qss.start( ref long def, long field_number, long position ) 
This indicates the search field's start position in the array element. For example, this allows you to search a string array for a character combination starting at the fourth character of the array element.

void qss.way( ref long def, long field_number, long way ) 
This defines the search order that must be used if the flag QSS.SRC.IS.SORTED is set. The argument way can be set to QSS.UP (ascending search) or QSS.DOWN (descending search).

void qss.type( ref long def, long field_number, long type ) 
This specifies the search field's type – for example, DB.LONG, DB.DOUBLE, DB.STRING, DB.DATE, and so on.

void qss.length( ref long def, long field_number, long length ) 
This specifies the length of the search field. This option is valid only for strings. 

If you define fewer search 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 search fieldss, as follows:


but then create only two search fields, you must close the definition with the following call:

 This indicates the number of array elements (starting with the first element) that must be searched if the function is not intended to search the entire array. By default, the function searches the entire array until it finds the required value.

Return values
>0        index in the array where the search key was found
-1         error; search argument not found
-11       search argument must be of same type as array; 
            def is not of type long array or tbl not of type array
-12       search argument not correct; string not expected
-13       dept must be positive
-14       def argument not correctly declared
-15       search argument does not fit in declared array
-16       QSS.TYPE not correct
-17       tbl argument not correct
-18       no definition found in def
-21       flag LOOKUP.FOR.STRUCT is used; search argument must be a string
-22       search argument not correct; probably a size problem – size of search 
            must match size of an element in tbl if LOOKUP.FOR.STRUCT is set or
            (if LOOKUP.FOR.STRUCT is not set) must be at least the sum of lengths 
            of the key fields (set by qss.length())
-23       search argument not correct; probably a type problem

Bshell function.
Reply With Quote
Old 25th January 2017, 16:13
VishalMistry's Avatar
VishalMistry VishalMistry is offline
Join Date: Dec 2004
Location: India, Gujarat
Posts: 580
VishalMistry has a little shameless behaviour in the past
Baan: Baan IV, ERPLn - DB: SQL Server 2000 / 2008 - OS: Windows Server 2003 / 2008

Thanks a lot. I was trying to store 5 numbers in array tmp, and then sort them.
After sorting tmp using qss.sort, when I am printing value of tmp(1,1), It is supposed to be 6, but it is showing 10.The code compiles but array is not sorted. The code is given below:

string tmp(10,5)

long sort_def(1,4)

t = load.long(tmp(1,1))

Can anybody solve, what could be the problem ?

Reply With Quote
Sponsored Links
Old 25th January 2017, 19:20
rahul ingale rahul ingale is offline
Join Date: May 2011
Location: Mumbai
Posts: 34
rahul ingale is on a distinguished road
Baan: baan infor - DB: sql - OS: windows xp
you are sorting one element as you have given 3rd argument to qss.sort function which state how many element to be sorted.just give 2 arguments to sort whole array.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is mean by spooler and what is it's purpose? Nammy2015 Tools Development 1 5th April 2013 09:52
Purpose of ttadv120 peturba Tools Administration & Installation 2 14th May 2008 10:48
using dll tiitmdll0003 ckassab Tools Development 2 7th December 2004 01:52
What purpose does Special depn code in initial setup serve (Fixed Ass) Nazeem Finance, Invoicing and Integration 2 10th April 2002 13:51
Purpose of Sessions NPRao Tools Administration & Installation 2 8th November 2001 18:13

All times are GMT +2. The time now is 23:41.

©2001-2017 - -