A TECHNICAL EYE ON DYNAMICS NAV

Quick Tip of the Week: 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:

  1. 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:

No Comments, Comment or Ping

Reply to “Quick Tip of the Week: Listing option string values”

What's cooking?

Photo credits