Monday, November 7, 2011

Navision Code Coverage

The Code Coverage tool differs from the debugger tool that is included in Microsoft Navision. However, the Code Coverage tool contains the same limitations as the debugger tool. You require Granule 7110 (Report & Dataport Designer) to run the Code Coverage tool.

Note If you cannot perform the following procedure, contact your local certified developer partner for help.

To determine the objects and the code that are used during a function, such as posting a sales order, follow these steps:

Step 1:Create a sales order, but do not post it.
Step 2:On the Tools menu, click Debugger, and then click Code Coverage.
Step 3:In the Code Coverage window, click Start.
Step 4:Return to the Sales Order window, and then post the sales order that you created in
step 1.

Step 5:Return to the Code Coverage window, and then click Stop.

Step 6:You see a list of all the objects that were used when the sales order was posted.
On the Tools menu, click Object Designer.
Step 7:Click Codeunit, click Codeunit 1 (ApplicationManagement), and then click Code to open the Code Overview window.

Codeunit 1 (ApplicationManagement) is one of the code units that are listed in the Code Coverage window.

The lines of code that have been run appear as black text. The lines of code that have not been run appear as red text.
In the Code Overview window, the lines of code appear just like the lines of code that appear in the debugger tool. For example, the Code Overview window uses the following formatting:
Bullets appear on each line that contains executable code.
The lines that are marked with a bullet are the only lines in which the information that is displayed is correct.
The lines of code that are not marked with a bullet appear in the same colors as the adjacent lines of code.

To clear the lines that are displayed in the Code Coverage window, click Start. To stop the Code Coverage routine, click Stop.

Note When you run the Code Coverage tool, a large log file may be generated. To reduce the size of the log file, perform steps 1 to 6, and then click Start in the Code Coverage window. After the Code Coverage tool starts, perform step 7.

Sunday, November 6, 2011

How to use CAST function in the definition of Linked Tables in NAV

Example 1

The original SQL script for the Linked Table

USE [NavisionTEST]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW [dbo].[Cronus$UC_CustomTableName]
AS
SELECT DeviceId,
(SELECT DATEADD(hour,
(SELECT DATEDIFF(hour, GETDATE(), getutcdate()) AS EXPR1), CustomTableName.ScanTime) AS EXPR1) AS ScanTime, DisplayLine1
FROM [2ndDATABASE].pfo.dbo.metric_CustomTableName AS CustomTableName
WHERE (DisplayLine1 LIKE '%toner%') OR
(DisplayLine1 LIKE '%cartridge%') ;



Example 2

The same SQL script used to define the Linked Table, being modified with the CAST function

USE [NavisionTEST]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW [dbo].[Cronus$UC_CustomTableName]
AS
SELECT DeviceId,
(SELECT DATEADD(hour,
(SELECT DATEDIFF(hour, GETDATE(), getutcdate()) AS EXPR1), CustomTableName.ScanTime) AS EXPR1) AS ScanTime,
CAST(DisplayLine1 AS NVARCHAR(250)) AS DisplayLine1
FROM 2ndDATABASE.pfo.dbo.metric_CustomTableName AS CustomTableName
WHERE (DisplayLine1 LIKE '%toner%') OR
(DisplayLine1 LIKE '%cartridge%')

Business Central SaaS Extension Design: Implementing Plant Tracking with AL Event Subscribers

  Extending Business Central SaaS: Plant Tracking Using AL Extensions  1️⃣ Problem Statement In many manufacturing and service-oriented or...