Using RW_Token to parse Runtime build numbers

David Meego - Click for blog homepageThis is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.

The tip for today is how a Report Writer function added into the core dictionary can be used to parse runtime version and build numbers.

You probably saw that an issue was found with the Support Debugging Tool build 12 for Microsoft Dynamics GP 2010 beta where it decided that the released version of Microsoft Dynamics GP 2010 was in fact version 8.00.  This caused the code to issue warnings and disable some of the tool’s functionality.  This issue was all fixed in build 13.

So what happened…

Well, the script I had written was looking for the text “8.00” in the string returned by Runtime_GetVersionNum() using the pos() function.  Because the build number for the Dexterity Runtime released with GP 2010 RTM was 11.00.0218.000 and contained the string “8.00”, the code incorrectly identified the version.

When the Support Debugging Tool was first developed for version 8.00, the Runtime_GetVersionNum() function returned a string in the format “8.00m88” and searching for “8.00” was a valid method.  It worked for versions 9.00, 10.00 and the GP 2010 beta, but failed for the GP 2010 RTM.

From version 9.00 onwards the format for build numbers returned by Runtime_GetVersionNum()was changed to the Major.Minor.Build.SubBuild format. For example: “9.00.0086.0”, “10.0.324.0” and “11.00.0218.000 “.  Notice that the padding with zeros differs between the versions so I cannot use the substring() function to grab characters by their positions.

So to fix the Support Debugging Tool for version 9.00, 10.00 and 11.00 (GP 2010), I had to work out a way to grab sections of the string using the full stop (period) as a separator.  I was about to write a function to do that for me when I remembered I had already created one as an Report Writer function.

RW_Token() was designed to convert numeric values into text.  In particular for converting Radio Buttons/Radio Groups and Drop Down Lists from integers into descriptive strings to show on reports.

You just need to specify the text to be parsed, the separator character and the position you want. The example below shows how to convert a manual car’s gears into text:

RW_Token(“First|Second|Third|Fourth|Fifth|Sixth”, “|”, Gear)

So using  the same function with a period as a separator I can get the sections of the string and return the value. See the code below:

Major    = value(RW_Token(Runtime_GetVersionNum(), CH_PERIOD, 1));
Minor    = value(RW_Token(Runtime_GetVersionNum(), CH_PERIOD, 2));
Build    = value(RW_Token(Runtime_GetVersionNum(), CH_PERIOD, 3));
SubBuild = value(RW_Token(Runtime_GetVersionNum(), CH_PERIOD, 4));

This is the code that is now used and it works perfectly.

Who says RW Functions can only be used from the Report Writer?!


// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL,

This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on

2 thoughts on “Using RW_Token to parse Runtime build numbers

  1. Thanks Dave, I was expecting to find this detail in a global variable. It seems all the GP windows simply use the Runtime_GetVersionNum() string.
    Are the no script preprocessors that we can use to compile version specific code based on the major version of GP?


Please post feedback or comments

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.