Good Afternoon, I have written several doubts, sorry for the insistence.
I want to know if there is way to give property to a field from type number to be autoincrementable ScriptCase but restarts when it reaches 99;
I want to say in 00 starts increasing to reach 99 and then start again at 00, and so susecivamente
thanks for any help
Generally you can not do that with a property but you can use the events with that easily.
It depends a bit on the database how you would implement it. for example you could create a sequence and modulo it with 100 and use the OnBeforeInsert … That should work.
Thanks for the prompt reply, do not know much or anything about programming, I would greatly appreciate if better detailing how could I do this kind of field.
That code I put in that event?
Well you need a bit programming for that and a bit database stuf. I assume that you need to use this value to store in the database? First you need to have a place where you can store the current sequencenumber. You cannot use a database autosequence as these only count up. Suppose you have a preference table containing your applications settings i.e. : create table preferences(pkey varchar(20), pvalue varchar(80) primary key pkey);
This table can store settings like ‘counter’ as pkey and ‘0’ as value.
In the onscriptinit you select the current value from the database
{MyCounter}= — value from database ----
Then you need to decide where the addition needs to be. I.e. after an update (onafterupdate) or after an insert (onafterinsert).
In this event you add one to your counter:
{MyCounter}={MyCounter} + 1;
if ({MyCounter} > 99)
{ {MyCounter}=0; }
// update your preference table now
In the code snippets which appear when you select an event you will find code snippets to select data from a table and insert / update data into a table.
Hope this helps.