Thursday 15 December 2016

Microsoft dynamics NAV Report

In simple term, Report is used to display certain information as specified in your filter from a database. Two important tasks are required to create a report
  • Designing the data model or dataset by using Report Dataset Designer
  • Design the Visual Layout: Also divided into 2
    • RDLC - Client Report Definition report Layout: created using Visual Studio Report Designer or SQL Server Report Builder.
    • Word Layout: created using Microsoft.
NB: I will only go into RDLC only

Report Dataset determines the data that is extracted or calculated from the Microsoft Dynamics NAV database tables that can be used in a report. Report Dataset is built from data items --which are tables and columns -- which can be any of these: field, variable, expression or text constant.

How to Create a Report Dataset
  • Open the Object Designer and select Report from the left navigation pane.
  • Click New to open a new Report
  • In the first blank line select the data item, the datasource and a CLS complaint name as the name.
  • In the second line select the column(s) you want for your report. 
    • Click View >> Select Field Menu to choose the fields you want. You can select multiple by holding down CTRL or SHFT key.
  • You can link Tables by indenting data items (table) under another data items (table)
    • Make sure you verify the DataItemLinkReference property is set to the Parent data item.
    • Also use the DataItemLink to connect the Tables - just like in SQL connecting the primary key to the foreign key (by setting the field and reference field)

Design the Visual Layout

The layout is designed in Microsoft Visual Studio Report Designer
It starts by opening Visual Studio Report Designer from the Report Object Designer in NAV Development environment.

  • Report >> Design
  • Click View >> Layout: this opens visual studio.
  • On VS, Click View >> Report Data: pin this to the left navigation pane of the IDE

From the Toolbox, drag a Table to the Designer, Right-Click the header to add Column (as many as required).
It is good practice not to hard-code your table therefore follow these steps to name your header and textbox values

  • Right-Click the header >> select Expression 
  • For the header. Select the parameter and double click the value. Repeat this step for all your headers


  • For the textbox: Select the Fields (second row) and double-click the value. Repeat this step for all your textboxes.



In the Properties window, select the Table properties and set the property DataSetName to DataSet_Result -which is automatically done by visual studio.

The Request Page

Request pages enable end users to specify options and filters for a report. It is created by default when a new report created. In addition, you can create custom options in the Request Page.You design these options  y using the Request Options Page Designer which is accessed from the Report Designer.

There are so any properties and functionalities in Report that I can't cover half of it in this blog, so I'll advice you to visit MSDN for more information

BUT
The headache here is that any visual design has to be done in Visual Studio and  you have to close VS before you can run the report on the RoleTailoredClient. This means any little customization requires you to open VS, make customization and close VS again before running report. 

Thursday 8 December 2016

Could not load file or assembly

I noticed after my upgrade to Microsoft Dynamics NAV 2015 version 8.00.40938  I get an error message on one of the boxes in my RoleCenter View 
"Control Add-in is missing could not load file or assembly Microsoft.Dynamics.Nav.Client.BusinessChart.Model".
I realized I was missing something then I tried this

This resolved my issue
I copied the BusinessChart Folder from my NAV Setup file into two paths on my C-drive
  •  C:\Program Files\Your_Path\Add-in\
  •  C:\Program Files (x86)\Your_Path\Add-in\
With this I was good to go. Happy me!!

Microsoft Dynamics NavClient stopped working


I read a lot of blogs to fix this issue but they all didn't work for me until I stumbled upon this, followed the one-time-step and it worked. This is the link to the step. Click here


How to Check the service running on your port.

I installed Microsoft Dynamics Nav 2015 on my machine and when I run it I get an error saying "Nav can't create a connection to the server". As usual I checked my event viewer to get a detailed message of the error. Then I found out another service -an earlier version of Microsoft Dynamics NAV (2013) was running on the same port as my Nav 2015. How did I know this?
  • Open command line
  • To check Service running on your port
    netstat -noa | find "port number" : It displays the PID
  • tasklist | find "PID"  : It displays the name of service running on your port which you can trace on Task Manger to disable it
Note: The PID is the last number after LISTENING
These simple steps saved my day as I was able to stop the process running on my port in Task Manager.



Tuesday 6 December 2016

Microsoft Dynamics NAV Codeunit

Codeunit is a container for C/AL code that you can use across different application objects. -- just think of it as a class of functions.

Codeunit by default contains two functions: Documentation and OnRun
Documentation: where you write descriptive information about the codeunit
OnRun: It executes any code when you run the codeunit.

By using codeunit, you eliminate the need for duplicate code and make code easier to maintain. You can access the codeunit's function from another codeunit by declaring a datatype of codeunit in a variable and specifying the name of the codeunit in the subtype. Then you can do this 
<CodeunitVariableName>.<FuntionName>. To access a codeunit from other application objects, you must set the Local Property of the function to "No"


Microsoft Dynamics NAV Table

There are 3 types of a table in MS Dynamics NAV namely:

  1. Temporary Table
  2. System Table
  3. Virtual Table
Temporary Table: This is a temporary variable that holds a table. It is used as a buffer for table data.It is similar to a database table but differs in the sense that it is not stored in the database it is only held in memory until the table is closed.

System Table: This table is required for Microsoft dynamics NAV to work properly. Do not make changes to this table because the changes may not be valid for the future upgrade of NAV. System table is stored in the database and is automatically created.

Virtual Table: This table contains system information. You can not change the table data but read the information only. Unlike System Table, it is not stored in the database but computed by Microsoft Dynamics NAV at runtime.

SIFT: SumIndexField Technology.
It allows a user to quickly calculate decimal columns in a table. It is used to optimize the performance of Flowfields. A SumIndexField is always associated with a key. Microsoft Dynamics NAV uses Indexed View to maintain a SIFT key.

FlowField
It is a result of the calculation described in the CalcFormula Property. It is not a physical field that is stored in the database. There are 7 types of flowfield namely:  Sum, Average, Exist, Count, Min, Max, Lookup. A flowfield is always associated with a calculation formula.
How to Create a FlowField
  1. Open Object Designer and select a Table, click Design.
  2. Select a field you want for flowfield calculation.
  3. Click properties, select flowfield in dropdown menu for FieldClass property.
  4. Click the assist button for CalcFormula property to define your calculation for the flowfield