Hello everybody.
I´m a newbie and I need help with something that I do with VFP but do not know how to proceedd with Servoy.
Here is the scenario:
I have a table named Counters, it just have 2 fields CounterName and Counter. I use it to keep track of some counters when registers are added to other tables. For example, the pk for the members table is created with this format: YYBBOOOOOO, where YY are the 2 last digits of the date, BB is the branch where the record is created and OOOOOO is a sequential number for the YYBB.
I need that everytime a new record is going to be added the pk for the members table be created so I think that I must place some code in the method where the new record is created.
I use to do this with VFP this way:
! First we check if the counter name exists.
lcCounterName=RIGHT(TRANSFORM(YEAR(DATE()),2) + oApp.cBranch
IF NOT SEEK(lcCounterName,‘counters’,‘countername’)
! Does not exist - > create it
INSERT INTO counter (countername) VALUES (lcCounterName)
ENDIF
! The current record in counters is the one that I need, because it was found or just created.
! Now I add 1 to the counter
REPLACE counters.counter WITH counters.counter + 1 in counters
lcPK=lcCounterName + PADL(TRANSFORM(counters.counter),6,‘0’)
RETURN lcPk
Any help about how to do this with Servoy?
Thanks in advance