Why does the get function need to be used in this instance:
if not SalesReceivableSetup.get() then
SalesReceivableSetup.insert();
if SalesReceivableSetup."Order Nos." = ' ' then begin
SalesReceivableSetup."Order Nos." := CreateNoSeries();
SalesReceivableSetup.Modify();
0
Answers
Why is it necessary to use the get function in this case?
If you don't do a GET, you don't position yourself on any records in the table, so you don't actually modify any values.
The GET in tables with a primary key of a single field is the equivalent of doing as many SETRANGE as fields have the primary key of other tables such as number 37, which you are doing in another part of the code.
SalesLine.SETRANGE("Document Type","Document Type");
SalesLine.SETRANGE("Document No.","Document No.");
SalesLine.SETRANGE("Attached to Line No.","Line No.");
By default if you will se these setup pages there's code written to check if its not blank then simply INIT INSERT, which ia actually inserting one record whose primary key value is something NULL you can say,
So that's why we simply GET which nothing as parameter and then it gets the reference for the entire columns.
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/