Quote:If @IsNew and item4 = "" then
{
item4 = @xlookup (@filename, counter - 1, "counter", "item4") + item3
}
I have ammended my previous note with this note in order to keep continuity. As a result of that, this note might appear as duplicate, please excuse me..Thinking further, the above code will work fine with mass update (ofcouse you have to remove If @isnew conditon), however, the way @number counter and I believe also counter created by globalvalue ( ) command, you might have to modify it a little bit.
If you open up form to add record and decide to exit it, the @number code will have already advanced the counter and there is no mechanism in place to reset it if you decide all of sudden to escape and not save the record. When you back to add new record the previous value in the counter would not coincide with any value.
One can solve this problem in more than one ways, just modify the code that it will read the record previous record the highest counter value.
If @IsNew and item4 = "" then
{
item4 = @xlookupr (@filename, 99999999999, "counter", "item4") + item3
}
There is other way you can accomplish this by using loop in subtracting 1 each time until it does not result in error. That is ..... if @error ... condition.
I am not upto the speed with loops quite yet.