_Ralph_
14th November 2006, 15:25
Hello Friends :)
I'm learning Tools and as everybody that try to learn something. I have a doubt. :confused:
I create a session named "Manter Clientes" its a client session which has a code field. This field need to be filled automatically by 1 number plus the last one stored
For example.
If was stored a client data that was enumerated with the code 1
the next need to be code 2.
after that 3
and so on....
can u help me?? :p
mr_suleyman
14th November 2006, 15:37
What kind of session do you mention ?
Maintain session, display session, print session ?
Is there only one field on your form ?
_Ralph_
14th November 2006, 15:40
Ow Sorry Mr.
Its a Maintain Session.
There are other fields.
It's like a Maintain Clients.
The fields are
Client Code
name
address
ID
Postal Code
email
and others..
mr_suleyman
14th November 2006, 15:48
for example on sesion your field is tcmcs001.code and your table is tcmcs001
Add your session script
field.tcmcs001.code:
before.field:
if update.status = add.set then
select (max(tcmcs001.code)+1):tcmcs001.code
from tcmcs001
selectdo
endselect
endif
You can improve this logic !
Good Luck !
_Ralph_
14th November 2006, 17:49
Thank you Mr.!
That was the logic i was expecting.
But it's not working :(
The table I'm using is tcspc008
the code field is tcspc008.func.o
ERROR: Syntax '(' not expected :confused: ¬¬"
field.tcspc008.func.o:
before.field:
if update.status = add.set then
select (max(tcspc008.func.o)+1):tcspc008.func.o
from tcspc008
selectdo
endselect
endif
I created a function with this command, and called it inside the IF. But the same error occurs..
any Idea?:D
mark_h
14th November 2006, 19:29
Try this:
field.tcmcs001.code:
before.field:
if update.status = add.set then
select max(tcmcs001.code):tcmcs001.code
from tcmcs001
selectdo
tcmcs001.code = tcmcs001.code + 1
selectempty
tcmcs001.code = 1
endselect
endif
_Ralph_
14th November 2006, 19:53
Thats works Mark!!! :eek:
Thanks!! A Lot
Mr!
Thanks a lot too for the intention and the atention :P
see ya :)