NAV Design Pattern of the Week – Temporary Dataset Report

After a short delay, here is the latest design pattern, brought to you by the Microsoft Dynamics NAV Design Patterns team.

Meet the Pattern

This pattern generates the data to be displayed dynamically by combing/processing several data sources. It then displays the resulting dataset without writing to the database.

 

Know the Pattern

 

While writing reports in Microsoft Dynamics NAV, we have the luxury of using a built-in iterator. So, once we define the dataitem and the ordering, the runtime takes care of the iteration.

 

The iterator has one shortcoming: It can only run through records written into the database. There are situations, however, where we want to display temporary datasets created at runtime by processing data from different sources. That is where the Temporary Dataset Report pattern can be used.

 

Use the Pattern

 

 This pattern takes a two-step approach to displaying the data:

 

  • Parse the data sources to create a record buffer in a temporary record variable.
  • Iterate through a data item of the Integer table and display one record from the temporary recordset in each iteration.

 

Step 1: Combining data sources to create a dataset

 

In this step, we would process the existing data to create a temporary recordset. The three most common techniques to do this are discussed in the following paragraphs.

 

The first technique is mostly used when we want to build the report based on one or more source tables. A lot of processing is required, and we therefore want to store and display information from a temporary recordset. With this technique, we create a data item of the source record and then iterate through this data item to create the temporary recordset. An advantage of this technique is that it allows the user to perform additional filtering on the data source tables since they are added as additional data items and therefore will have their tabs on the request page by default.

 

 

The second technique was made available with NAV 2013 when queries were introduced as a tool to help us combine data from different sources.

Read the entire pattern on NAV Wiki…

 

Best regards,

Abhishek Ghosh from the Microsoft Dynamics NAV Design Patterns team