h3nry_99
30th August 2002, 06:41
Dear All,

In our purchase inquiry number, the first 2 digit is code by Department that refer to first free number (under purchase inquiry). Ex : 12xxxx with first free number 12 is for Purchasing Dept.
My problem is how can we get first 2 digit and seek in first free number table (in script ) ? In some other programming language, there is function to convert from numeric to string and string back to numeric. Is there any function like that in Baan that convert one data type to another ?


Regards,

klesch
30th August 2002, 08:48
Check this functions:

long lval( string_expr )
double val( string_expr )
string str$( num_expr )
string edit$( expression, string format(.) )
long string.scan( str_expr, string format(.) [, variable, ...] )

ulrich.fuchs
30th August 2002, 10:42
Use the modulo operator for this. It gives you the remainder of an integer division.

The modulo operator in Baan is the Backslash char: \

eg: 12\10 evaluates to 2

So, to retrieve your first free number you can use


ffno = (tdpur001.qono - (tdpur001.qono \ 10000)) / 10000



Uli

dbinderbr
30th August 2002, 20:07
Hello,

You can try to use this example:

string hold.str.orno
long serie

tdpur999.orno = 129999

|# Convert to string
hold.str.orno = str$(tdpur999.orno)

|# Get the two first numbers and convert the result to long
serie = lval(hold.str.orno(1;2))

Now you have the serie variable with the right value to find a record into the first free number table.