Development Tips, Excel, Instalation & Configuration, Jet Reports, Report

Enable SOAP Services and identify connection parameters

Jet express calls Web Services (SOAP) when running reports or accessing information from

Microsoft Dynamics NAV 2015. Using the Microsoft Dynamics NAV Server Administration Tool select the instance that you want to use and check the box next to Enable SOAP Services.

If Jet Express will be used outside a secure network then SSL should be enabled for the SOAP Services to help provide security and data integrity for data communications.
JetExcel-5
From the Microsoft Dynamics NAV Server Administration Tool record the

  • Credential Type
  • Server Name
  • Instance (note: for performance reasons, it is strongly recommended that a separate instance be created solely for use by Jet Express)
  • SOAP Services Port
  • Whether SSL is enabled for SOAP Services

This information is required for configuring your data source connection in Jet Express on client machines.

Note – You cannot run both Jet Express and Jet Essentials on the same computer.

Checkout Upcoming posts for more information.

Development Tips, Excel, Instalation & Configuration, Jet Reports, Office Integration, Report

Publishing the Jet Data Source Codeunit to the Web Service

Microsoft Dynamics NAV 2015 includes a “Jet Data Source” codeunit which must be published to enable Jet Essentials or Jet Express to operate. This can be published using the Microsoft Dynamics NAV Role Tailored Client (RTC).

To publish this code unit, inside the RTC go to Departments > Administration > IT Administration > General and select Web Services.

JetExcel-4
Publish the Jet Data Source code unit by selecting New from the Web services ribbon

  • Object Type: Codeunit
  • Object ID: 14125500
  • Service Name: Jet Data Source
  • And check the box to publish.
  • Click OK

Checkout Upcoming posts for more information.

Development Tips, Excel, Instalation & Configuration, Jet Reports, Office Integration, Report

Installing and Publishing the Jet Business Objects on the Microsoft Dynamics Server

To install the .fob file open the Microsoft Dynamics NAV Development Environment and then connect to the database.

  • Open the Object Designer (on the Tools menu, choose Object Designer)
  • Import the .fob file (on the File menu, choose Import)
  • Locate the import file (Jet Reports Objects.fob), and then choose Open.
  • The .fob file includes modified objects. When prompted choose Yes to import all objects.
  • Verify that no objects are to be skipped. Objects are skipped if the version of the object in the database is later than the one in the .fob file.
  • Choose the OK button to import the .fob file.

The .fob file installs a set of business objects in the range of 14125500-14125504 and Table 14125600.
JetExcel-3
Jet Express users must have Read, Insert, Modify, Delete (RIMD-) permissions to Table 4125600 “Jet Cancellation”.

Checkout upcoming posts for more information.

Development Tips, Excel, Instalation & Configuration, Jet Reports, Office Integration, Report

Installing Jet Express for Excel – Navision 2015

Jet Express is an Excel add-in which must be installed each client machine. The client machines must have Excel installed.

Download the current version of Jet Express

  • Download the version of the product that matches your version of Microsoft Office (either 32-bit or 64-bit).
  • Microsoft Office 2007 is 32-bit.
  • If you are using Microsoft Office 2010 you can determine this by selecting the File On your version of Excel.
  • Button in your Excel ribbon and then selecting either Help or Account, depending
  • If you attempt to install the wrong version you will receive an error message and the application will not install.
  • Run the .exe file.
  • If you receive a message asking “Do you want to allow the following product to make
  • Changes on this computer?” select YES.

Once Jet Report is installed, when you open your Excel you will get new Tab as Jet.
JetExcel-2

Checkout upcoming posts for more Information.

Development Tips, Excel, Instalation & Configuration, Jet Reports, Office Integration, Report

Jet Report for Excel – Navision 2015

In my previous posts I introduced with Jet Report for Word.

Please see here. Links below:-

Jet Express for Word Overview & Installation – for Navision 2015

Jet Express for Word – Objects for Navision 2015

What’s New in Jet Reports for Word, How it is different from Navision Word Reports

Customize the Report layout using Jet Express for Word

You can access the resource for Jet Report Excel from this Link.

JetExcel-1

Download the Jet Express Setup & Jet Reports Objects from the site.

Run the Setup to install the Jet Express for Excel.

You may require Activation Code, which you can obtain following the instructions post setup.
Checkout upcoming posts for more details.

Development Tips, Jet Reports, Office Integration, Report

Customize the Report layout using Jet Express for Word

Click Edit Layout to customize this layout
JetReportDesign-1

The Jet Express for Word action panel may automatically open when this word file is opened.

If not, select the Jet Ribbon

Click on the Design icon

This presents a tree hierarchy of the fields from the selected report. 
JetReportDesign-2

Click on the icons on the hierarchy to expand or contract the lists.

The Search field makes it easy to find the fields you need.

Labels – NAV reports which were created by Jet Reports include a section for Labels. These fields are the descriptions of the fields themselves.

If you have multiple languages in your NAV instance, these labels can be helpful for creating multi-language documents.

Other Groupings – NAV reports which were created by Jet Reports include sections for Company, Customer, etc. These fields include the values of the fields.

The user can select from fields including Header or Lines in the hierarchy and insert an item, typically into a table in the Word document.
JetReportDesign-3

To add a field select the desired location in the Word document and double-click on the field.

Alternatively, you can select the field and click on the Insert button in the Jet Express for Word action panel.

To Add a picture to a document, right-click on the item and select Insert Picture
JetReportDesign-4

The Lines fields are also inserted as text and can be replicated by a Right-click, and choosing “Insert Repeater”.

Repeating items (such as Sales lines on a Sales order) can be added to a document.
JetReportDesign-5

Best practice for this is to create a table in Word that is two rows high.

The first row contains the Labels of the fields that you wish to include.

The second row contains the values of the fields.

Select the entire second row- include the area just to the right of the last column.

Right-click on the item in the hierarchy that you want to repeat and select Insert

To delete an item, click on it, and then click on its Title.
JetReportDesign-6
When you click on the Title it will change color.

Then press the Delete Button on your keyboard.

Note: It’s important to select the Title when deleting to avoid any leftover data.

When you have completed your changes Save your Word document
JetReportDesign-7
This will return you to NAV and prompt you to import the report layout changes.
JetReportDesign-8
Click Yes

You can Run Report to review your changes.
JetReportDesign-9
Here is the output for the report below.
JetReportDesign-10
We are done with customization of the report using Jet Reports.

I will come up with more details in my upcoming posts.

Development Tips, Jet Reports, Office Integration, Report

What’s New in Jet Reports for Word, How it is different from Navision Word Reports

Before we compare both the way of creating report in word, the features I would be suggesting you to review the posts which I have posted earlier Word Document Reports and Custom Layouts to refresh the concept of creating reports in Word.

Let’s start with comparing how it is different from Navision Word Report.

Create a custom layout for the report you wish to use

In your NAV client navigate to Report Layout Selection (Administration/IT Administration/ Reports).

Microsoft Dynamics NAV 2015 includes several sample Word reports including:

14125500             Sales Order – Jet Ex. Word

14125501             Sales Invoice – Jet Ex. Word

14125502             Sales Cr. Memo – Jet Ex. Word

14125504             Sales Quote – Jet Ex. Word

I have filtered the above Reports.

Select the report that you wish to customize. (I am Using 14125500 for this example)
CustomiseJetReport-1
Click Custom Layouts.

 To create a new Report Layout, click New.

A pop-up window will appear and allow you to choose the layout type.

Check the Insert Word Layout box and click OK.

CustomiseJetReport-2

CustomiseJetReport-3

In the Report Layouts window, you can change the Description.

Click OK

In the NAV Custom Report Layouts window, highlight the layout you wish to use and click the Import Layout button from the ribbon.

Browse to the Jet Express for Word Sample Documents, choose the template you want and click Open
CustomiseJetReport-4
Click Edit Layout to customize this layout.

CustomiseJetReport-5

Above screenshot show how to Access the XML part of the Report.

Left side shows Jet->Design

Right side shows Developer->XML Mapping Pane

If you remember In Navision word Report we use to select the Custom XML Part from the dropdown to access the available fields, Labels etc.

Whereas if we see In Jet Report this is not required.

Also you may have observed that Jet Report Pane Have search option, which makes easy to find desired fields rather than scrolling through the XML Nodes to access the desired Fields.
CustomiseJetReport-6

You may observe in above picture that I have typed the part of the Field I am looking for and Jet Report Pane suggested that Similar to what I typed there is a Field “Salesperson” and it available under 2 heads Labels & Header data items.

If I require to insert the Labels or Fields, Place the cursor at desired place where you want that Field to be inserted and Double Click to the Field from Jet Report Pane.
CustomiseJetReport-7
Where as to perform same action in Navision Word Place the cursor where we wish to Insert the Field then we use to Scroll to the Field we wish to insert then we perform step Right Click->Insert Content Control->Plain Text
CustomiseJetReport-8
I will come up with more details in my next post. We will see how we can design the Report Using Jet Report fast and easily.

Also some Best Practice, Tip & Tricks while using Jet Reports.

Report

Usage of RUNREQUESTPAGE, EXECUTE, SAVEAS and PRINT function of Reports Object

Today we will discuss usage of RUNREQUESTPAGE, EXECUTE, SAVEAS and PRINT function of Report Object.

You will be using RUNREQUESTPAGE function to run the request page of desired Report.

We will save the value of Parameters in Table for further use. For this we will require to create a table with below structure let name it as Report Request Parameters.

Create a table called Report Request Parameters that has the following fields.

Field Name Data Type Length
ReportId Integer
UserId Code 100
Parameters BLOB

ReportParameter-1

Then we will use these value with

EXECUTE – To preview the report.

SAVEAS – To save it as pdf file.

PRINT – To print the Report.

To continue with our demo we will require to create a codeunit, let’s name it as Using Report Functions.

We will add the following variables in the C/AL Globals window.

Variable name DataType Subtype Length
ReportParameters Record Report Request Parameters
XmlParameters Text
OStream OutStream
IStream InStream
CurrentUser Code 100
Content File
TempFileName Text

ReportParameter-2

Now we will add the following code to the OnRun trigger of the codeunit.

We will be taking Report 206 as an example for this demo.

ReportParameter-3

You can copy below code for your demo.

// Use the REPORT.RUNREQUESTPAGE function to run the request page to get report parameters

XmlParameters := REPORT.RUNREQUESTPAGE(206);

CurrentUser := USERID;

// Save the request page parameters to the database table

WITH ReportParameters DO BEGIN

// Cleanup

     IF GET(206,CurrentUser) THEN

DELETE;

SETAUTOCALCFIELDS(Parameters);

ReportId := 206;

UserId := CurrentUser;

Parameters.CREATEOUTSTREAM(OStream,TEXTENCODING::UTF8);

MESSAGE(XmlParameters);

OStream.WRITETEXT(XmlParameters);

INSERT;

END;

CLEAR(ReportParameters);

XmlParameters := ”;

// Read the request page parameters from the database table

WITH ReportParameters DO BEGIN

SETAUTOCALCFIELDS(Parameters);

GET(206,CurrentUser);

Parameters.CREATEINSTREAM(IStream,TEXTENCODING::UTF8);

IStream.READTEXT(XmlParameters);

END;

// Use the REPORT.SAVEAS function to save the report as a PDF file

Content.CREATE(‘TestFile.pdf’);

Content.CREATEOUTSTREAM(OStream);

REPORT.SAVEAS(206,XmlParameters,REPORTFORMAT::Pdf,OStream);

Content.CLOSE;

// Use the REPORT.EXECUTE function to preview the report

REPORT.EXECUTE(206,XmlParameters);

// Use the REPORT.Print function to print the report

REPORT.PRINT(206,XmlParameters);

We are done, definitely this will help you doing some useful stuffs in your projects.

Run the Codeunit and see the output. You will get three output

a) Report Output will be saved as pdf, you can specify your custom path to save the file to specified location.

b) Report Print Preview

c) Report will be send for Printing

Development Tips

Creating File Attachment to Mail for Report

We generally get requirements from clients to send report output as attachment to the mail.

In Microsoft Dynamics Navision 2015 this feature is available at most of the places, but we can design for other earlier versions too.

Long-time back I was having this requirement from one of my client, those days I scanned lots of website and tried lots of method. This one I found compact and easy to use. Their after whenever I get similar requirements I prefer using this.

Today I wish to share the same with others, as I have used it in my several implementations and found it working perfect and tested with several clients.

Let’s see this, it could help someone getting his work done in easy way and can save lots of time from hit and try with several methods.

First step, I will create a function which will help us generating the file on Service tier and down load to local temporary folder, so that we can easily access and attach to our mail.

Let’s give it a meaningful name like: DownloadToClientFileName

I will define two parameters for this Function as below:

Var Name DataType Subtype Length
No ServerFileName Text 250
No ToFile Text 250

I will define Return Value of Function as: Text of Length 250

I will define Local Variables for Function as below:

Name DataType Subtype Length
ClientFileName Text 250
objScript Automation ‘Microsoft Script Control 1.0’.ScriptControl
CR Text 1

Now we will write Code for the Function as below:

ClientFileName := ToFile;

IF NOT DOWNLOAD(ServerFileName, ”, ‘<TEMP>’,”, ClientFileName) THEN

EXIT(”);

IF CREATE(objScript,TRUE,TRUE) THEN

BEGIN

CR := ‘ ‘; CR[1] := 13;

objScript.Language := ‘VBScript’;

objScript.AddCode(

‘function RenameTempFile(fromFile, toFile)’+CR+

‘set fso = createobject(“Scripting.FileSystemObject”)’+CR+

‘set x = createobject(“Scriptlet.TypeLib”)’+CR+

‘path = fso.getparentfoldername(fromFile)’+CR+

‘toPath = path+”\”+left(x.GUID,38)’+CR+

‘fso.CreateFolder toPath’+CR+

‘fso.MoveFile fromFile, toPath+”\”+toFile’+CR+

‘RenameTempFile = toPath’+CR+

‘end function’);

ClientFileName := objScript.Eval(‘RenameTempFile(“‘+ClientFileName+'”,”‘+ToFile+'”)’);

ClientFileName := ClientFileName+’\’+ToFile;

END;

EXIT(ClientFileName);

Second Step, I will write code to call this function to attach the file to Mail and send using SMTP as below:

//SMTP is an Variable of Codeunit SMTP Mail

SMTP.CreateMessage(SenderName,SenderAddress,Recipient,Subject,Body,TRUE);

//SenderName,SenderAddress,Recipent is an email addresses

SMTP.AppendBody(Body);

CLEAR(MailReport);

//MailReport is Variable for Report of which output we want to use as attachment.

//Name & ToFile is Text type variable of Length 250

Name := STRSUBSTNO(‘Estimate No. %1.pdf’, SalesHeader.”No.”);

//Creating File Name

ToFile := Name;

FileName := TEMPORARYPATH + ToFile;

//We are using temporarypath OS Variable to get the path for file

MailReport.SetMailFilters(SalesHeader);

MailReport.SAVEASPDF(FileName);

ToFile := DownloadToClientFileName(FileName, ToFile);

SMTP.AddAttachment(ToFile);

FILE.ERASE(FileName);

SMTP.Send;

Now you can create a template function and use where ever require.

Report

Managing Report Layouts

Microsoft Dynamics NAV 2015 enables reports to have a single built-in RDLC and Word layout, shared among tenants, as well as any number of customized layouts per tenant.

To browse and manage which layout is currently used for a given report, a new Report Layout Selection list page has been introduced.

We will use the Report Layout Selection page to switch between and run the RDLC and Word layouts that are shipped as part of the new Sales Invoice report 1306.

  • Open Report Layout Selection page by doing one of the following:
  • In the Search box, enter Report Layout Selection, and then choose the related link.
  • In the navigation pane, choose Departments, Administration, IT Administration, Reports, and then Report Layout Selection.
  • In the Small Business Role Center, on the Actions tab, choose Setup, Company Information, and then choose Report Layouts.
  • Ensure that the Company Name field is set to the correct company because reports layouts are company-specific.

ReportLayout-2

ReportLayout-3

The Report Layout Selection page lists all of the reports that are available for the company that is specified in the Company field at the top of the window.

The Selected Layout field specifies the layout that is currently used for a given report.

A report can be set up with more than one report layout, which you can then switch among as needed.

Depending on the layouts that are available for a report, you can choose to use a built-in RDLC layout, a built-in Word layout, or a custom layout.

From the Report Layout Selection page, it is also possible to manage custom layouts for reports.

  • In the list, locate the document report 1306 Sales – Invoice by doing one of the following:
  • Scroll down through the list.
  • Filter on the Report ID equal to 1306.
  • Select the row for report 1306.
  • Choose the down arrow in the Selected Layout field to show the options (RDLC, Word, and Custom).

ReportLayout-4

First we will have a look at the new report 1306 Sales – Invoice, which has a built-in RDLC and Word layout. Out of the box, it does not have any custom layouts – we will add these in later posts.

As you can see, the RDLC (built-in) is typically the layout that selected by default. This can, however, be controlled by using the Default Layout property on the specific report object in Microsoft Dynamics NAV Development Environment.

Notice that the page also contains a Custom Layouts FactBox. This lists any available custom layouts for a selected report in the list. If there are no custom layouts for the report, then you will have to create one first.

  • In the row for report 1306, set the Selected Layout field to RDLC (built-in).
  • On the Home tab, in the Report group, choose Run Report.
  • In the resulting report request page, use default values, and then select the Print button and choose PDF.
  • Open and inspect the resulting PDF file for report, which is based on the RDLC layout.

We will now select and run the built-in RDLC layout for report 1306 Sales – Invoice from the Report Layout Selection list page.

ReportLayout-5

ReportLayout-6

  • In the Report Layout Selection page, select the line for report 1306, and then set the Selected Layout field to Word (built-in).
  • On the Home tab, in the Report group, choose Run Report.
  • In the resulting report request page, use default values, and the select the Print button and choose PDF. [Note: This might not work for all client setups because it relies on server-side PDF conversion. As an alternative, use the Preview option on the request page, which will result in a Word document.)
  • Open and inspect the resulting PDF file for the report, which is based on the Word layout

Finally, we will change the layout to the built-in Word layout and then run the report.

ReportLayout-7

ReportLayout-8