_Ralph_
19th December 2006, 16:02
Hello Everyone!;)
I have a table eucom102 wich contains 3 fields.
- Code - eucom102.code
- Name - eucom102.name
- Description - eucom102.desc
With its respective session already created. The field eucom102.code need to be in a sequencial order starting from 0. So I created the following:
|**************field section*************
field.eucom102.code:
before.input:
eucom102.code = auto.number()
|**************function section**********
functions:
function domain tcorno auto.number()
{
long num.x
select max(eucom102.code):num.x
from eucom102
selectdo
num.x = num.x +1
endselect
return(str$(num.x))
}
In ERP LN the domain tcorno was turned into String.:mad:
In Baan the codes would be organized this way:
0, 1, 2, 3, 4, 5, 6, 7, 8,9 ,10, 11, 12,...
In LN the order is:
0, 1, 10, 11, 12, 2, 3, 4, 5, 6, 7, 8, 9, ...
So when used
select max(eucom102.code):num.x
The number stored will be ever "9". And the return: 10.
I heard about use a function of a Library that fix this problem. And gives me the choice to use a code with letters and number. like ABC001, ABC002 and so on(As Sales/Purchase Orders) But I don't know how to work with libraries.
Could you clear my mind please??
Thanks a lot!
I have a table eucom102 wich contains 3 fields.
- Code - eucom102.code
- Name - eucom102.name
- Description - eucom102.desc
With its respective session already created. The field eucom102.code need to be in a sequencial order starting from 0. So I created the following:
|**************field section*************
field.eucom102.code:
before.input:
eucom102.code = auto.number()
|**************function section**********
functions:
function domain tcorno auto.number()
{
long num.x
select max(eucom102.code):num.x
from eucom102
selectdo
num.x = num.x +1
endselect
return(str$(num.x))
}
In ERP LN the domain tcorno was turned into String.:mad:
In Baan the codes would be organized this way:
0, 1, 2, 3, 4, 5, 6, 7, 8,9 ,10, 11, 12,...
In LN the order is:
0, 1, 10, 11, 12, 2, 3, 4, 5, 6, 7, 8, 9, ...
So when used
select max(eucom102.code):num.x
The number stored will be ever "9". And the return: 10.
I heard about use a function of a Library that fix this problem. And gives me the choice to use a code with letters and number. like ABC001, ABC002 and so on(As Sales/Purchase Orders) But I don't know how to work with libraries.
Could you clear my mind please??
Thanks a lot!