First off I am no coder. I have been given the task of converting over a database from Lotus Notes 5 to Lotus Notes 7. I worked with 5 years ago and now we are going back to notes. Everything has worked properly so far except form numbering. I did a search but haven’t found anything I understand. This code only generates 0001 and won’t increment. was there a change that makes this code stop running that it isn’t incrementing? Or maybe something new that it is missing?
Control No. is a field and (EQP Control No.) is a view.
Control No.
FIELD ContNum := ContNum;
tmp := @DbColumn(“” : “NoCache”; “”; “(EQP Control No.)”; 1);
@If(@IsError(tmp); @Return(“Error”); tmp);
REM; “Start with zero if the variable comes back blank”;
tmp1 := @If(tmp = “”; “0000”; @Subset(tmp; -1));
REM; “Extract the numeric part as a number”;
CurrentContNum := @TextToNumber(tmp1);
NextContNum := CurrentContNum + 1;
REM; “Calculate number of zeroes you need to pad with to get a 4 digit number”;
Zeroes := (NextContNum < 1000) + (NextContNum < 100) + (NextContNum < 10);
REM; “Return the result”;
@If(tmp1 != “”; @SetField(“ContNum”; @Repeat(“0”; Zeroes) + @Text(NextContNum)); “Error”)
(EQP Control No.)
SELECT Form = “DOCUMENT” & !@Contains(ContNum; “Error”) & !@IsError(ContNum) & ContNum != “”
This is Column 1 of (EQP Control No.) view
REM; “Get a five digit number”;
tmp := @Trim(@Right(ContNum; 5));
REM; “Check for the left most digit to see if it is a number”;
tmp1 := @If(@IsError(@TextToNumber(@Left(tmp; 1))); “0” + @Right(tmp; 4); tmp);
REM; “Now check to see if the second left most digit is a number”;
REM; “Adjust the result accordingly based on a 4 or 3 digit number. If it is a five digit number leave it alone”;
@If(@IsError(@TextToNumber(@Right(@Left(tmp1; 2); 1))); “00” + @Right(tmp1; 3); tmp1)
Any help would be appreciated before I submit this to testing so they can add it on the server.