Over the years since Mark Rockwell and I published the Pushing the Limits with Dexterity, I have been asked a number of times about accessing dictionary resources such as tables and fields. This is information that is not stored anywhere in SQL tables and can only be accessed using Dexterity sanScript code to “read” the resources definitions.
Usually, I would point the developer to the Resource_ function library and the conference materials. However, in today’s world where developers are not always familiar with Dexterity, sending them off to learn Dexterity and write their own code is probably not the best solution.
The reason that this topic has come up today is because of the .Net application that reads table & field display names post on the Community Forum. The .Net developer on this post has an external .Net application that needs to work with the Microsoft Dynamics GP tables, but would like to use the user friendly display names rather than the cryptic physical names (as per the SQL table and column names).
The developer knows how to call Dexterity from a .Net application, but does not have the Dexterity knowledge to write the code to extract the data. Getting to table data is not too hard, but pulling the field data out of the dictionary is complex due to the handling required for array and composite fields. I decided that it would be worth writing and publishing some code that could be called as passthrough Dexterity sanScript which would output the resources as tab delimited text files. These files can be read into Excel or any other application.
I used the Runtime Execute window in the Support Debugging Tool to write the code (shown below) which can be modified as desired.
Note: When executing this code via passthrough sanScript from VBA or Visual Studio, make sure the dictionary context is set to 0 for Dynamics using the .CurrentProductID property.
The Support Debugging Tool settings file with this code and example TABLES.TXT and FIELDS.TXT files are attached to the bottom of this post.
Let me know if you find this useful.
08-Jul-2010: Have a look at Mark Polino’s article about how he has used this code: Getting Table and Field Data out of Dexterity Dictionaries in Dynamics GP.