Categories
Dynamics NAV HOW TO Microsoft

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

[sourcecode lang=”Cside”]
TESTFIELD("Starting Date Formula",ZeroDateFormula);
[/sourcecode]

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.

[sourcecode lang=”Cside”]
IF PeriodLength = ZeroDateFormula THEN
ERROR(Text001);
[/sourcecode]

Did my HOW TO help you? Leave a reply.

Categories
Dynamics NAV Microsoft

Root element is missing

Microsoft Dynamics NAV
—————————

This message is for C/AL programmers: A call to System.Xml.XmlDocument.Load failed with this message: Root element is missing.
—————————
OK
—————————

This message is for C/AL programmers: A call to System.Xml.XmlDocument.Load failed with this message: Root element is missing

Assumption:
You verified that the code you are going to load as XML is not empty.

Solution 1:
Verify that each tag has the corresponding closing tag

Solution 2:
Make sure that the stream Position is set to 0 (zero) before to load the Stream
[sourcecode lang=”Cside”]
IF stream.Position > 0 THEN
stream.Position := 0;
[/sourcecode]

Did my solution solve your problem? Leave a reply.