Follow me on Twitter

A technical eye on Microsoft Dynamics NAV

Quick Tip: Adding a CR/LF to Dataports

in Quick Tips by Ian Crocker


Photo credit: Jessica Donohoe

Need to add a carriage return/line feed at the end of a Dataport?

Click to continue →

Quick Tip: Standard text codes

in Quick Tips by Ian Crocker


Photo credit: amortize

Enter a single question mark in any editable Text or Code field, then tab away from the field.

The Standard Text Codes form will be launched and you can select a text.

The code which makes this happen can be found in Codeunit 1 in a function called MakeText.  

You could in theory hijack this function and code your own escape characters for your own purposes.

Quick Tip: Listing option string values

in Quick Tips by Ian Crocker


Ever been writing a piece of code where you need to reference a specific value in an Option type field but either couldn’t remember the value you want to use or simply want to see a list of all the existing options?

One way to do this would be to open the table, select the field in question and look at the values in the OptionString property.

A faster way is to write your code as far as possible, then, using an arbitrary value such as x, place this where you would normally put the option string value.

In the example below I want to check the document type of a Cust. Ledger Entry record:

IF CustLedgEntry."Document Type" = CustLedgEntry."Document Type"::x THEN

Hit F11 to compile the code.  

It won’t compile because x is not a valid option string value.  

However, listed in the error message returned by the compiler will be a handy reminder of all the existing option string values for the field:

What's cooking?

Photo credits

View Ian Crocker's profile on LinkedIn