HOW TO show BigText in a message window in C/AL

According to the MSDN documentation in the link BigText Data Type

"cannot be shown in a message window"

This example requires that you create the following variables:

Name DataType Subtype
varBigText BigText

It is true that you cannot insert the BigText in a message

MESSAGE(varBigText);

HOW TO show BigText in a message window in C/AL?

You can show the content of the variable easily using the FORMAT Function (Code, Text) to convert the BigText in a String.

MESSAGE(FORMAT(varBigText));

Did my HOW TO help you? Leave a reply.

Page contains several Actions with the same ID

Microsoft Dynamics NAV
—————————
Page {PageNo} {PageName} contains several Actions with the same ID {ActionID}. Redesign the page to remove duplicate Action IDs.
—————————
OK
—————————

contains several Actions with the same ID

Solution:
Delete lines for page in the error from the 2000000074 Profile Metadata system table.

Did my solution solve your problem? Leave a comment.

You do not have the following permissions on TableData

When we develop in Microsoft Dynamics NAV, we use a Developer License that has permissions to the standard objects different of the license of the final customer.

Using the customer’s license you may encounter error messages as follows:

You do not have the following permissions on TableData {TableName}: {Read/Insert/Modify/Delete}

An example could be running a Codeunit that modify a record in the standard table 6550 Whse. Item Tracking Line.
You do not have the following permissions on TableData

Considerations:
I’m pretty sure that most of you after will receive an error like this, first will search the table number of the one in the error message. Then you will realize that is in the range of the standard objects (e.g. 6550) and you will start thinking why this error didn’t happen during your tests.

Well, the answer is obvious if you think that probably you tested using the Developer license and that the Customer’s license has different permission to access to the standard objects.

Causes:
Create a new Page using the wizard of type List to show all the fields of the system table Permission Range.
Then run it with the Customer’s license and filter for the object in the error message (i.e. TableData 6550)
Permission Ranges
As you can see, this TableData in the Customer’s license has Insert/Modify/Delete permission as Indirect. This means that you CANNOT do those action directly in that table.

Note: Remind that if you are saving the license in the database or you upload a new license you must restart the instance service.

In the meantime you realized (maybe debugging) that the code that caused this error is in a Codeunit. Bingo!!!

You do not have the following permissions on TableData

Solution:
Open the Codeunit in design and assign in the Properties the correct Permissions to the tables
Permissions

Did my solution solve your problem? Leave a comment.

Working with dates in NAV

To work following the standards avoids future issues.

In this post I’d like to suggest a way to convert dates in NAV.

Working with dates in NAV

A date in your system can have different formats depending on the preferences of your country and language.

You can come across different errors, for example Server and Client with different settings or ambiguous date because valid between two different formats (e.g. 05/04/2015 that could be DD/MM/YYYY or MM/DD/YYYY)

To avoid this confusion there is an International Standard that is the standard XML format that returns the date in the following format

YYYY-MM-DD

In NAV you can use the FORMAT Function (Code, Text) with the following declaration:

String := FORMAT(Value[, Length][, FormatStr/FormatNumber])

and using the FormatStr = 9 to return a string in XML format

FORMAT(varDate,0,9);

Note: Leaving the Length = 0 then the entire value is returned.

This example requires that you create the following variables:

Name DataType Subtype
varDate Date

Example:

varDate := DMY2DATE(5,4,2015);
MESSAGE(FORMAT(varDate,0,9));

It will return
Working with dates in NAV

How to convert from a string in XML format back to a field or variable of type Date?

To convert a string in a date in NAV we need to call the EVALUATE Function with the following declaration:

[Ok :=] EVALUATE(Variable, String[, Number])

It’s interesting that also in this function we can use Number = 9 to set that the string expected will be in XML format.

Using the standard XML format you will work in accordance to the standards and the configuration of your Server or Client, language or preference in your system will not affect your work and each date will be converted always in the same manner.

Remind that you can use the same functions and logic working with DateTime.

Did my post help you? Leave a reply.

HOW TO load xml from a file in C/AL

In the following example we are going to: open a file, create an InStream object, create an XmlDocument using the DotNet component and load the xml from the InStream.

This example requires that you create the following variables:

Name DataType Subtype
TestFile File
Istream InStream
XmlDoc DotNet
System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

HOW TO load xml from a file in C/AL?

TestFile.OPEN('C:\TestFolder\TestFile.xml');
TestFile.CREATEINSTREAM(Istream);

XmlDoc := XmlDoc.XmlDocument();
XmlDoc.Load(Istream);

Did my HOW TO help you? Leave a reply.

Could not load file or assembly Microsoft.Dynamics.Nav.Management.dll HRESULT: 0x80131515

Information
—————————

Could not load file or assembly ‘file:///C:\Program Files\Microsoft Dynamics NAV\70\Service\Microsoft.Dynamics.Nav.Management.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
—————————
OK
—————————

Symptoms:
After an update with a new build of Microsoft Dynamics NAV the Microsoft Dynamics NAV Administration tool does not work showing an error message as above.

Solution:

  1. Move the file Microsoft.Dynamics.Nav.Management.dll from the folder
    C:\Program Files\Microsoft Dynamics NAV\70\Service\

    into your Desktop

  2. Right-click on the file, select Properties and in the General tab push the button at the bottom Unblock
  3. Move the file Microsoft.Dynamics.Nav.Management.dll from the Desktop to the original folder
    C:\Program Files\Microsoft Dynamics NAV\70\Service\

Did my solution solve your problem? Leave a comment.

HOW TO test if a DateFormula variable is empty

We can learn a lot reading Microsoft standard C/AL code.

HOW TO test if a DateFormula variable is empty?

An example is offered in the Table 5088 Profile Questionnaire Line

TESTFIELD("Starting Date Formula",ZeroDateFormula);

Solution:
Create a Global Variable named like ZeroDateFormula of DataType DateFormula and don’t assign any value to it.

Now you can use this variable to test if a DateFormula variable is empty.

IF PeriodLength = ZeroDateFormula THEN
  ERROR(Text001); 

Did my HOW TO help you? Leave a reply.