How to write lesser code in NAV...!!??!!
I would like to share today about With Statement. When we work with records(except Current record 'rec'), addressing is created as record name, dot (period), and field name:
For example let say we are coding into Sales line table with 'Item' record. then we need to continuously use "Item.FieldName" and if we need to write code for ten or twenty fields or any field repeatedly then it makes no sense using Item(Dot) always. This is where we should know WITH STATEMENT.
SYNTAX:
********
WITH <Record> DO <Statement>
********
EXAMPLE:
********WITH ITEM DO BEGIN "No." := '1234'; //Instead of Item."No." Description:= 'Pokemon GO Server'; //Instead of Item.Description "Unit Cost" := '50000.50'; //Item."Unit Cost" //Other codes END;*****Ref: https://msdn.microsoft.com/en-us/library/dd338911.aspx
No comments:
Post a Comment