hi, my colleague told me that their is an official document in which is described how variables should be sorted in navision. something like “records and other object-variables first” came in his mind but after searching for some time in the c/al document, the application designers guide and some more we didn’t find a text like this. does anybody know where to find it ?
Hi, you’re right. Here it’s what I found in the manual C/AL Programming Guide. Variables should be listed in the following order: 1 Record variables 2 Form variables 3 Report variables 4 Dataport variables 5 Codeunit variables 6 Dialog, file and BLOB variables 7 Simple variables Record variables are listed in an order that reflects the hierarchy of the tables used in the database. Base tables come before journals and other non-posted lines and headers, which themselves come before ledger entries and posted lines and headers. EXAMPLE VAR GLSetup : Record 98; UserSetup : Record 91; ItemPostingGr : Record 94; Item : Record 27; ItemJnlTemplate : Record 82; ItemJnlBatch : Record 233; ItemJnlLine : Record 83; ItemReg : Record 46; ItemLedgEntry : Record 32; I hope it’s what you’re looking for. Bye Ilaria
great that’s it big thx
Why is this so great? What’s the reason to sort your vars on the declaration form.
i am currently updating our internal style guide and one point is that in large codeunits the search for a variable in the declaration forms takes too long cause everybody declares his variables in the order when he needs them in his code … if you sort them you can get a fast overview on for example your records so the caution to declare needless variables when bugfixing or updating your code isn’t so big …its a kind of “how to make my source so friendly that everybody in the team needs less time to understand and fix or support it”