Tag Archives: Microsoft Dynamics NAV
Session time-out: Microsoft Dynamics NAV 2016 Window
References Configure Session Timeout – Dynamics NAV | Microsoft Learn Pre-requisites Microsoft Dynamics NAV 2016. Introduction In this blog, I am going to showcase how to set session timeout on the NAV window. Scenario: The session timeout is 15 minutes; if the client connection is inactive for more than 15 minutes, the connection is lost. Let’s have a look at the setting for session time out. Hope this helps!
How to use LinkedObject property
Introduction: There can be a case where developers might need to display data from different companies in NAV or Unique view of Tables displaying unique values of a table or Joins from Tables. In such cases, developers can use the “LinkedObject” property of a table. Pre-requisites: VS Code AL Language Extension Microsoft Dynamics NAV Solution: Step 1: Go to SQL Server Management Studio and create a view of the table from where you want to display field values. Here I have created a view of Customer Table to display distinct Customer Names. And saved the view as “AdityaCustomer” Company Name as the prefix. View Step 2: Now, In NAV Development Environment create a table with the same as the view that has been created, Do not include the company prefix. And add the field with the same name of the field included in View. Table in NAV Linked Object Property Step 3: When this Table is run, you can see distinct Customer names in the Table. Conclusion: This way developers can display data from Views using LinkeObject property. Hope this helps!
How to retrieve a Sub-string from a String
Problem Statement: We have a requirement where the client wants a part of String from Sales Order No. which is Code(Data type) and it is auto-generated from Number Series. The Sales Order No. value is “SO/123/789/456”. The required Sub-string was: 123<Space>789. Pre-requisites: VS Code AL Language Extension Microsoft Dynamics NAV / Business Central Solution: As per the requirement, we need to first retrieve Sub-strings “123” and “789” and this can be achieved using SELECTSTR( ) function. But SELECTSTR() only retrieves a Sub-string from a comma-separated String. And the Sales Order No. string is a slash-separated string. So firstly we need to convert this string to comma-separated string, which is achieved in the below-presented screen. CONVERTSTR(String, From Characters, To Characters) In the above Screen, “SalesOrder No.” is initialized in a text variable “SoNumber” and then is converted to a comma-separated string. The code is: CONVERTSTR( String: Text, FromCharacters: Text, ToCharacters: Text ) Now comes the part where we retrieve Substring from this converted String using SELECTSTR( ) function as the string is now converted into a comma-separated string, below screen shows how it is done. SELECTSTR(Number/Position, Comma-Separated String) As you can see in the above screen how SELECTSTR() function is used to retrieve substring on the 3rd and 4th position of the String and stored in text variables “No1” and “No2” respectively. And these variables are then initialized to another variable with space. The code is: SELECTSTR(Position, Commastring); In the above example the code is: SELECTSTR(3, Separatenumber); SELECTSTR(4, Separatenumber); Conclusion: We can retrieve a comma-separated string or any other character-separated string using CONVERTSTR() and SELECTSTR() functions. Hope this helps!
Update Sub-form (Sub-Page) from Main Page to apply Filters.
Problem Statement: I have a requirement where I want to update the Subform(Part page) from the Main page, this Subpage(Subform) is linked to the Main page by SubpageLink Property. The Subpage is a List page and I want to filter this list by a field from Main Page. Pre-requisites: VS Code AL Language Extension Microsoft Dynamics NAV / Business Central Solution: To solve the above Problem statement we have to make use of the Currpage.Update() function which shall update the Subpage. As you can see in the below window a function is created Vendorfilter() on Subpage with the “vendor” parameter, in this function filter is added for the vendor on the part page and then CurrPage.Update() is used. This function will update the Subpage with the vendor. Now, call this function on “OnValidate” trigger of the Main page field, here we have “Vendor” field on Main Page. The calling of Function is as follows: CurrPage.<SubpageName>.Page.<FunctionName>(Rec.<FieldName>); In this example we have CurrPage.POLines.page.Vendorfilter(Rec.Vendor); Conclusion: Thus we can achieve updating a Subform from a Main Page. Hope this helps!