I tried Creating Line No. programatically using this code:
//Function GetLineNo
recBMGICollectionDetails2.RESET;
recBMGICollectionDetails2.SETRANGE(recBMGICollectionDetails2."Document No.","No.");
IF recBMGICollectionDetails2.FIND('+') THEN BEGIN
"Line No." := ROUND(recBMGICollectionDetails2."Line No.",1000,'=') + 1000;
END ELSE BEGIN
"Line No." := 1000;
END;
That code is inside in a LOOP condition :
FOR I := 1 TO vTerms DO BEGIN
vCount := vCount + 1;
WITH recBMGICollectionDetails DO BEGIN
INIT;
vBMGIDate := Date;
"Line No." := GetLineNo;
IF vBMGIDate = 0D THEN BEGIN
Date := CALCDATE(vMonths,vDate);
END ELSE BEGIN
Date := CALCDATE(vMonths,vBMGIDate);
END;
"Document Code" := GetNextCode(vStartingNo,vCount);
Amount := ("Lawn Lot Amount"/vTerms);
INSERT;
END;
END;
CurrPage.UPDATE;
But error gave the error Line No. Already Exist. As you see, I already put INSERT so on the next loop the GETLINENO will give me the next the new Value of LINE No. can somebody help me with this? thanks in advance.
//Function GetLineNo
recBMGICollectionDetails2.RESET;
recBMGICollectionDetails2.SETRANGE(recBMGICollectionDetails2."Document No.","No.");
IF recBMGICollectionDetails2.FIND('+') THEN BEGIN
"Line No." := ROUND(recBMGICollectionDetails2."Line No.",1000,'=') + 1000;
END ELSE BEGIN
"Line No." := 1000;
END;
That code is inside in a LOOP condition :
FOR I := 1 TO vTerms DO BEGIN
vCount := vCount + 1;
WITH recBMGICollectionDetails DO BEGIN
INIT;
vBMGIDate := Date;
"Line No." := GetLineNo;
IF vBMGIDate = 0D THEN BEGIN
Date := CALCDATE(vMonths,vDate);
END ELSE BEGIN
Date := CALCDATE(vMonths,vBMGIDate);
END;
"Document Code" := GetNextCode(vStartingNo,vCount);
Amount := ("Lawn Lot Amount"/vTerms);
INSERT;
END;
END;
CurrPage.UPDATE;
But error gave the error Line No. Already Exist. As you see, I already put INSERT so on the next loop the GETLINENO will give me the next the new Value of LINE No. can somebody help me with this? thanks in advance.