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, http://opensource.org/licenses/ms-pl.html.)
Posting from Mark Polino at DynamicAccounting.net
PLEASE READ BEFORE POSTING
Please only post comments relating to the topic of this page.
If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.