Business Central: Intellisense to assign correct variable names in AL (AL Variable Helper)

Dynamics 365 Business Central

Hi, Readers.
Precise and consistent terminology helps the end user work with the application. Rules for naming and abbreviating objects also help developers to understand the CRONUS International Ltd. demonstration database and develop new features faster.

Guidelines for naming variables in Naming Objects, Fields and Variables:

GuidelineExamples
Omit spaces, periods, and other characters such as parentheses that make quotation marks around a variable necessary.GenJnlBatch
Replace currency unit signs such as $ with the corresponding currency unit code. Note: This may not make a variable unique. To be unique, it must be different from the corresponding field name. Also, the variable is not necessarily unique when translated to another language.AmountUSD
Start variables with uppercase letters.
If a variable is a compound of two or more words or abbreviations, then start each word or abbreviation with an uppercase letter.
Describe the variable usage wherever possible. If possible, start with the table name. If there are several variables in an object that would otherwise have the same name, then use appropriate prefixes or suffixes to differentiate them.CustInvDiscAmountLCY

EnteredPostingDate (where the prefix is Entered)
Follow country/region-specific rules for abbreviations.
When you set up table and field variables, give the variable the same name as the table or field as described in the Table Fields section.
If a variable with the same name already exists, then add the number 2 to the variable name. If a variable with this name also exists, then use 3, and so on. Use these numbers only if you cannot establish a unique variable in another way.CustLedgEntry2, NewCustLedgEntry (better than CustLedgEntry2)
Note that parameters and local variables have their own number series. Do not name a parameter GenJnlLine4 because a global variable named GenJnlLine3 already exists.
To use a variable to store a value temporarily, start the variable name with “Temp”.TempType
Use “Old” and “New” as prefixes for record variables when you have old tables and new tables.
Do not use “x” as a prefix. This is used only in table triggers when the record variable is created automatically by the development environment.
Include “Total” in the name of a variable that is used for totaling.
Use “From” or “To” when you are copying from or to a table.
Use “Starting” or “Ending” with dates and positions.
Use “First” or “Last” with the first or last record in a table or line in a journal. You can also use it as a flag to indicate that this is the first record that is processed.FirstOrder
When a variable is a Record, Page, Report, XMLport, Query, or Codeunit data type and the object has a name that also functions as a field name or local function name, add the suffix Rec, Page, Report, XMLport, Query, or Codeunit.SourceCodeRec (for a record variable from the Source Code table) Note: Because “Source Code” is the name of a table and the name of a field in other tables, you should not use “SourceCode” for variables that hold the two different types of information.

Today I would like to share a very convenient extension in VS Code that can be used in Business Central development, AL Variable Helper.

You can find and install this extension in the Maketplace.

My best favorite Usage: Intellisense to assign correct variable names.

To create a new variable type t + (e.g. trecord), then select a name for the variable tab to the name and select a name with Ctrl + Space. (Note: Please do not enter the object name directly)

trecord:

tpage:

Test video:

To go to global/local variables, hit CTRL + L or CTRL + G.

All features:

  • Easy variable assignment
  • Go to global/local variables – like in the C/SIDE environment.
  • Sort Variables
  • Fix keyword casing

Give it a try!

PS: Some Suggested Abbreviations

AbbreviationText
Absabsence
Accaccount
Accaccounting
Accumaccumulated
Actaction
Activactivity
Addadditional
Addraddress
Adjadjust
Adjdadjusted
Adjmtadjustment
Agrmtagreement
Allocallocation
Allowallowance
Altalternative
Amtamount
Amtsamounts
Ansanswer
Applapplies
Applnapplication
Arrivarrival
Asmassembly
ATOassemble to order
Assgntassignment
Assocassociated
Attmtattachment
Authauthorities
Autoautomatic
Availavailability
Avgaverage
BAba db.
Balbalance
BOMbill of materials
Blnktblanket
Budgbudget
Bufbuffer
Busbusiness
BIMbusiness interaction management
Buybuying
Calccalculate
Calcdcalculated
Calcucalculation
Calcalendar
Capcapacity
CRPcapacity requirements planning
CFcash flow
CFcashflow
ctlgcatalog
Catcategory
CPUCentral Processing Unit
Ctrcenter
Chgchange
Chgschanges
Charcharacter
Charscharacters
Chrgcharge
Chrgscharges
Chkcheck
Classclassification
collcollection
colcolumn
Cmtcomment
Cocompany
Compcomponent
Cmpltncompletion
Compscomponents
Compncomposition
Comprcompression
Concrntconcurrent
Confconfidential
Cnfrmnconfirmation
Conflconflict
Consolconsolidate
Consolidconsolidation
Consumpconsumption
Contcontact
Cntrcontainer
Contrcontract
Contrdcontracted
Ctrlcontrol
Ctrlscontrols
Convconversion
Corcorrection
Correscorrespondence
Correspcorresponding
Cstcost
COGSsold
Crcredit
Cumulcumulate
Currcurrency
Crntcurrent
Custcustomer
CVcustomer/vendor
Dlydaily
Dampdampener
DBMSdatabase management system
Ddate
Defdefinition
Demodemonstration
Deptdepartment
DPdepartment/project
Deprdepreciation
Descdescription
Dtldetail
Dtlddetailed
Dtlsdetails
Devdeviation
Diffdifference
Dimdimension
Dirdirect
Discdiscount
Discrdiscrete
Distrdistribute
Distrddistributed
Distbtrdistributor
Distrndistribution
Docdocument
Duplduplicate
Entrdentered
Enginengineering
Exchexchange
Exclexcluding
Execexecute
Expdexpected
Expedexpedited
Expexpense
Exprexpression
Expirexpiration
Extextended
Explexplode
Exptexport
Fnlfinal
Finfinance
Fiscfiscal
Fnshdfinished
FAfixed asset
Fwdforward
Frtfreight
Gengeneral
GLgeneral ledger
Grgroup
Hdrheader
Histhistory
Holholiday
HRhuman resource
IDidentification
Impimport
Inbndinbound
Inclincluding
Incldincluded
Incmgincoming
ISVindependent software vendor
Industindustry
Infoinformation
Initinitial
IntraIntrastat
Interactinteraction
Integrintegration
Intinterest
IntmInterim
IPinternal protocol
Invtinventory
Invtblinventoriable
Invinvoice
Invdinvoiced
ITitem tracking
Jnljournal
Langlanguage
Ledgledger
Lvllevel
Lnline
Ltlist
LCYlocal currency
Loclocation
Mailmailing
Maintmaintenance
Mgtmanagement
Manmanual
Mfgmanufacturing
Mfrmanufacturer
Matmaterial
Mktgmarketing
Maxmaximum
Measmeasure
Msgmessage
Minminimum
Miscmiscellaneous
Modmodify
Mthmonth
Negnegative
NonInvtblnon-inventoriable
Notifnotification
Nonumber
Nosnumbers
Objobject
Operoperating
Oppopportunity
Ordorder
Ordsorders
Origoriginal
Orgorganization
Outbndoutbound
OutgOutgoing
Outoutput
Outstdoutstanding
Ovhdoverhead
Pmtpayment
Pctpercent
Persnlpersonnel
Physphysical
Picpicture
Plngplanning
Pstdposted
Postposting
Pospositive
Precprecision
Prepmtprepayment
Prodproduct
Prodproduction
ProdOrdproduction order
Projproject
Propproperty
Prspct  prospect
Purchpurchase
Purchpurchases
Purchrpurchaser
PurchOrdpurchase order
Qltyquality
Qtyquantity
Questnquestionnaire
Qtequote
RFradio frequency
Rngrange
Rcptreceipt
Rcdreceived
Recrecord
Recsrecords
Recnclreconcile
Reconreconciliation
Recurrecurring
Refreference
Regregister
Regnregistration
Regdregistered
Relrelation
Relsrelations
Rlshprelationship
Rlserelease
Rlsdreleased
Remremaining
Rmdrreminder
Replreplacement
Rplnshreplenish
Rplnshtreplenishment
Rptreport
Reprepresent
Repdrepresented
Rqstrequest
Reqdrequired
Reqtrequirement
Reqtsrequirements
Reqrequisition
Rsvreserve
Rsvdreserved
Reservreservation
Resolresolution
Resresource
Rspresponse
Respresponsibility
Rtnretain
Rtndretained
Retreturn
Retsreturns
Revalnrevaluation
Revreverse
Rvwreview
Rndround
Rnddrounded
Rndgrounding
Rteroute
Rtngrouting
Routroutine
Salessales & receivables
Safsafety
Schedschedule
Secsecond
Segsegment
Selselect
Selctnselection
Seqsequence
Serserial
SNserial number
Servservice
Shsheet
Shptshipment
Srcsource
Spclspecial
Specspecification
Specsspecifications
Stdstandard
SFfrequency
Stmtstatement
Statstatistical
Statsstatistics
Stkstock
SKUstockkeeping unit
Stmstream
SQLstructured query language
Subcontrsubcontract
Subcontrdsubcontracted
Subcontrgsubcontracting
Subsubstitute
Substsubstitution
Sugsuggest
Sugdsuggested
Sugnsuggestion
Sumsummary
Suspdsuspended
Symptsymptom
Synchsynchronize
Temptemporary
Tottotal
Transactransaction
Transtransfer
Translntranslation
Trkgtracking
Tblshttroubleshoot
Tblshtgtroubleshooting
UOMunit of measure
UTunit test
Unrealunrealized
Unrsvdunreserved
Updupdate
Valnvaluation
Valvalue
VATvalue added tax
Varvariance
Vendvendor
Whsewarehouse
WSweb shop
Wkshworksheet
GLg/l
Pct%
Three-Tier3-tier
OsynchOutlook Synch

End

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL