Mastering String Labels in Dynamics GP: A Clear Display Guide
In Microsoft Dynamics GP, configuration settings that utilize option groups (also known as radio buttons) are not typically stored as descriptive text strings directly within the database tables. Instead, these selections are commonly saved as integer values. This integer represents the position of the chosen option within its group, often starting from a base index like zero or one depending on the implementation.
While storing options as integers is efficient for database management, it presents a challenge when these values need to be displayed on reports or forms in a user-friendly format. An integer like ‘0’, ‘1’, or ‘2’ does not immediately convey the meaning of the selected option to a user viewing a report. To make these reports understandable and professional, it becomes necessary to translate these integer codes back into their corresponding text labels.
This article details the process for converting these integer representations of radio groups into meaningful string labels within Microsoft Dynamics GP Report Writer. The key tool for this conversion is a user-defined function available within Report Writer. By following the steps outlined below, you can enhance the clarity and usability of your Dynamics GP reports.
Understanding the Challenge: Integers vs. Strings¶
When you configure a setting in Dynamics GP using a set of radio buttons, the system records your choice internally as a numerical value. For example, if you have a group of options labeled “Option A”, “Option B”, and “Option C”, and you select “Option B”, the system might store this choice as the integer ‘1’ if “Option A” is the first option (index 0). This integer is often stored in a specific field within a relevant table in the Dynamics GP database.
The issue arises when you attempt to pull this data onto a report using Report Writer. If you simply place the field containing this integer value onto the report layout, the report will display ‘0’, ‘1’, ‘2’, etc., instead of the actual option text “Option A”, “Option B”, “Option C”. Report users would then need external documentation or prior knowledge to understand what these numbers represent, which significantly hinders the report’s effectiveness. The goal is to have the report display the descriptive text associated with each integer code, providing immediate clarity.
The Solution: Utilizing the RW_Token Function¶
Microsoft Dynamics GP Report Writer provides a powerful user-defined function called RW_Token. This function is specifically designed to extract a specific token (or string) from a delimited list of strings based on an index number. This makes it the ideal tool for translating the integer values of radio groups into their corresponding string labels.
The RW_Token function typically takes three arguments:
1. A single string containing the list of possible string labels, separated by a specific delimiter character.
2. The delimiter character used to separate the strings in the list.
3. The index number (an integer) corresponding to the desired string label in the list.
A crucial detail is that the RW_Token function is 1-based, meaning it expects the index number to start from 1 for the first item in the list. However, the integer values stored for radio groups in Dynamics GP often start from 0. This discrepancy requires a simple but necessary adjustment: adding 1 to the integer value retrieved from the database before passing it to the RW_Token function. This adjustment ensures that the 0-based database integer correctly maps to the 1-based index required by the function.
To implement this solution, you will create two calculated fields in Report Writer. The first calculated field will take the original integer value from the radio group field and add 1 to it. The second calculated field will then use this adjusted integer value, along with the list of string labels and the delimiter, as inputs for the RW_Token function. This second calculated field will return the correct string label, ready to be placed on your report.
Step 1: Back Up the Reports.dic File¶
Before making any modifications to reports in Microsoft Dynamics GP, it is critical to back up your Reports.dic file. The Reports.dic file is where all your modified reports are stored. Any issues during the modification process could potentially corrupt this file, leading to the loss of all your custom reports. A backup allows you to restore your previous working version if something goes wrong.
To back up your Reports.dic file:
1. Navigate to the Tools menu in Dynamics GP.
2. Point to Setup.
3. Point to System.
4. Select Edit Launch File.
5. If prompted, enter the system password.
6. In the Edit Launch File window, identify the product associated with the report you intend to modify (e.g., “Microsoft Dynamics GP” or “Great Plains”).
7. Note the exact path displayed in the Reports field. This is the location of your Reports.dic file.
8. Close the Edit Launch File window by selecting OK.
9. Using Windows File Explorer, navigate to the path you noted.
10. Locate the Reports.dic file and copy it to a safe location, such as a network drive or a dedicated backup folder. Include the date in the backup file name (e.g., Reports_Backup_YYYYMMDD.dic) for easy tracking.
This backup ensures that you can recover your existing modified reports if any problems occur during the modification process. It is a fundamental best practice for anyone performing customizations in Dynamics GP.
Step 2: Accessing Report Writer¶
After securing your backup, the next step is to open Microsoft Dynamics GP Report Writer. This is the tool used to create, modify, and manage all reports within the system. Accessing it is straightforward from within the Dynamics GP application.
To open Report Writer:
1. From the Tools menu in Dynamics GP, point to Customize.
2. Select Report Writer.
3. In the Report Writer window that appears, you will be asked to select the Product. Choose the product that the report you want to modify belongs to.
* If you are using Microsoft Dynamics GP 9.0 or later, select Microsoft Dynamics GP.
* If you are using Microsoft Business Solutions - Great Plains 8.0 or 7.5, select Great Plains.
4. Select OK to launch Report Writer.
Once Report Writer is open, you will see various windows and menus that allow you to work with report definitions, tables, relationships, and calculated fields. You are now ready to load the specific report you wish to modify.
Step 3: Modifying the Report Layout¶
This is the core step where you will implement the logic to display the string label. You will open the existing report you want to modify and create the necessary calculated fields.
Substep 3.1: Open the Report Layout¶
- In Report Writer, select the Reports icon or navigate to Reports > Modify.
- In the Original Reports list, find the report you want to modify and select it.
- Select Insert >> to move the report to the Modified Reports list.
- Select the report name in the Modified Reports list and then select Open.
- In the Report Definition window, select Layout. This will open the Report Layout window, which is a visual designer for your report.
Substep 3.2: Create the Adjusted Integer Calculated Field¶
You need a calculated field that takes the original integer value from the database field and adds 1, preparing it for the 1-based RW_Token function.
1. In the Toolbox window (usually on the left side of the screen), select Calculated Fields from the dropdown list at the top.
2. Select New. This opens the Calculated Field Definition window.
3. In the Name box, type a descriptive name for this field, such as Radio Group + 1 or Adjusted Radio Value.
4. Ensure the Result Type is set to Integer. The Expression Type should be Calculated.
5. In the lower section, select the Fields tab.
6. In the Resources list, select the table that contains the radio group field you want to modify.
7. In the Field list, find and select the specific radio group field (the one containing the integer value).
8. Select Add. This adds the field to the Expression box above.
9. Select the plus sign (+) button on the Report Writer toolbar to add the addition operator to the expression.
10. Select the Constants tab.
11. In the Type list, select Integer.
12. In the Constant field, type 1.
13. Select Add. This adds the constant value ‘1’ to the expression.
14. Your expression in the Expression box should now look something like [Table_Name.Radio_Group_Field] + 1.
15. Select OK to save this calculated field.
Substep 3.3: Create the String Label Calculated Field¶
Now you will create the main calculated field that uses the RW_Token function and the adjusted integer value to return the string label.
1. In the Toolbox window, with Calculated Fields still selected, select New again.
2. In the Calculated Field Definition window, type a descriptive name for this field, such as Radio Group Label or Converted Option String.
3. Set the Result Type to String. The Expression Type should be Calculated.
4. In the lower section, select the Functions tab.
5. Select User-Defined from the list on the left.
6. In the Core list on the right, select System.
7. In the Function list, find and select RW_Token.
8. Select Add. This adds FUNCTION_SCRIPT(RW_Token to the Expression box. Report Writer automatically handles the closing parenthesis and necessary syntax for user-defined functions.
9. You now need to provide the three arguments for RW_Token in the correct order, separated by commas.
* Argument 1: The list of strings. Go to the Constants tab. Select String as the Type. In the Constant field, type the list of possible string labels exactly as you want them to appear on the report, separated by a unique token character (e.g., | or , or :). The order is crucial: the first string corresponds to index 1 (which maps back to database value 0), the second to index 2 (database value 1), and so on. For example, if the options are “Debit” and “Credit”, and “Debit” is the first option (0 in database) and “Credit” is the second (1 in database), you would enter "Debit:Credit". Remember to enclose the entire string list in double quotes. Select Add.
* Argument 2: The token character. Go back to the Constants tab. Select String as the Type. In the Constant field, type the single character you used as the delimiter in the string list (e.g., :, ,, or |). Enclose the token character in double quotes. Select Add.
* Argument 3: The adjusted integer value. Go to the Fields tab. In the Calculated list, select the calculated field you created in the previous substep (e.g., Radio Group + 1). Select Add.
10. The complete expression in the Expression box should now look similar to FUNCTION_SCRIPT(RW_Token "String1|String2|String3" "|" 'Adjusted Radio Value'). Note the single quotes around the calculated field name.
11. Select OK to save this string calculated field.
Substep 3.4: Add the String Field to the Layout¶
- Return to the Report Layout window.
- In the Toolbox window, ensure Calculated Fields is selected.
- Find the string calculated field you just created (e.g.,
Radio Group Label) in the list. - Click and drag this field onto the desired section of your report layout (e.g., the Body section or a Footer section).
- Position the field where you want the string label to appear. You may want to remove or hide the original integer field from the layout to avoid confusion.
Substep 3.5: Save the Modified Report¶
- Close the Report Layout window by clicking the red ‘X’ in the corner. When prompted to save changes to the layout, select Save.
- Close the Report Definition window by clicking the red ‘X’. When prompted to save changes to the report, select Save.
Your report is now modified to display the string label instead of the integer value for the selected radio group.
Here are some examples of how the RW_Token function expression might look for common Dynamics GP fields:
FUNCTION_SCRIPT(RW_Token "Balance Sheet,Profit and Loss" "," 'Posting Type + 1')
Assuming Posting Type 0 is “Balance Sheet” and 1 is “Profit and Loss” and the calculated field adding 1 is named ‘Posting Type + 1’.
FUNCTION_SCRIPT(RW_Token "Debit:Credit" ":" 'Typical Balance + 1')
Assuming Typical Balance 0 is “Debit” and 1 is “Credit” and the calculated field adding 1 is named ‘Typical Balance + 1’.
FUNCTION_SCRIPT(RW_Token "Check|Cash|Credit Card|EFT" "|" 'Payment Type + 1')
Assuming Payment Type 0 is “Check”, 1 is “Cash”, 2 is “Credit Card”, 3 is “EFT”, and the calculated field adding 1 is named ‘Payment Type + 1’.
Remember to carefully match the order of strings in your list to the expected integer values (after adding 1) and ensure the delimiter character is consistent.
Troubleshooting Common Issues¶
When working with Report Writer and calculated fields, especially the RW_Token function, you might encounter issues. Here are some common problems and how to approach them:
- Incorrect String Returned: The most frequent issue is mismatching the order of strings in your list with the corresponding integer values. Double-check the actual 0-based index of each option in the Dynamics GP window where the setting is configured. Then, ensure your string list in the
RW_Tokenfunction has the correct string at the position that corresponds to[Original Value] + 1. For example, if the original value 0 maps to “Yes” and 1 maps to “No”, your string list should be"Yes|No"and the token character|. If the original value is 0, adding 1 gives 1, which selects “Yes”. If the original value is 1, adding 1 gives 2, which selects “No”. - Function Syntax Error: Ensure you have correctly entered the
RW_Tokenfunction and its arguments. Arguments must be separated by commas, and string constants must be enclosed in double quotes. The adjusted integer field name must be enclosed in single quotes. - Report Writer Freezing or Crashing: Complex calculated fields or issues within the Report Writer application itself can sometimes cause instability. Ensure you have saved your work frequently. If Report Writer becomes unresponsive, you might need to force close it. This is why having a backup of
Reports.dic(Step 1) is so important. - Field Not Displaying on Report: Make sure you have dragged the string calculated field (not the original integer field or the adjusted integer field) onto the report layout and placed it in a section that will print (like the Body or a Footer).
- Security Not Granted: After modifying the report, you must grant security access to the modified version for users to see the changes. This is covered in the next step. If users still see the original report, it’s likely a security configuration issue.
By systematically checking these areas, you can usually identify and resolve problems encountered during the report modification process. Referring to the Report Writer documentation (often available in the Dynamics GP SDK) can also provide valuable insights into function usage and troubleshooting.
Step 4: Grant Security to the Modified Report¶
After successfully modifying and saving your report, users will not automatically see the changes. Dynamics GP security controls which version of a report (Original, Modified, or Alternate) users have access to. You must grant security to the modified version of the report for the appropriate users or roles. There are a couple of methods to do this.
Method 1: Using the Advanced Security Tool¶
The Advanced Security tool provides a hierarchical view that makes it easy to see and assign access to alternate and modified objects.
- In Dynamics GP, go to the Tools menu, point to Setup, point to System, and select Advanced Security.
- If prompted, enter the system password.
- In the Advanced Security window, select View and then select by Alternate, Modified and Custom.
- Expand Microsoft Dynamics GP (or Microsoft Great Plains) in the tree view.
- Expand Reports.
- Expand the node for the appropriate series (e.g., Financial, Sales, Purchasing) where your report resides.
- Expand the node for the specific report you modified.
- You will see different versions listed (e.g., Microsoft Dynamics GP (Original), Microsoft Dynamics GP (Modified), Microsoft Dynamics GP (Alternate)).
- Select the checkbox next to Microsoft Dynamics GP (Modified) (or Microsoft Great Plains (Modified)) for the users, companies, or roles that should have access to this modified report. You navigate through the tree view on the left to select the specific users, companies, or roles you want to configure.
- Select Apply.
- Select OK to close the Advanced Security window.
Users who were granted access via this method should now see and use the modified report when they print it.
Method 2: Using Microsoft Dynamics GP Security (Pre-GP 2013 R2)¶
In older versions of Dynamics GP (prior to GP 2013 R2) or for users who prefer the older interface, security was typically managed through the Standard Security window.
- In Dynamics GP, go to the Tools menu, point to Setup, point to System, and select Security.
- If prompted, enter the system password.
- In the Security window, select the User ID or Role ID you want to configure.
- Select the Company.
- In the Type list, select Reports.
- In the Series list, select the appropriate series for your report.
- In the Access List window, find the report you modified. You might see multiple entries if alternate reports exist.
- Look for the entry that indicates it’s the modified version. The name might be slightly different or indicated by a status column depending on the GP version. Select the modified report.
- Select Add to move it to the Selected Objects list.
- Close the Security window.
Repeat for any other users or roles who require access to the modified report. It’s generally recommended to use roles for managing security, as this simplifies administration, especially with many users.
After granting security, users should log out of Dynamics GP and log back in for the security changes to take effect.
Best Practices for Report Customizations¶
Modifying reports in Dynamics GP using Report Writer is a powerful way to tailor the system to specific business needs. To ensure a smooth process and maintainability, consider these best practices:
- Work in a Test Environment: Always perform report modifications in a test or development environment first. This allows you to experiment freely without risking your live production data or disrupting users.
- Document Your Changes: Keep a record of the reports you have modified, the changes you made (especially details about calculated fields like the string list and delimiter), and the date of the modification. This documentation is invaluable for troubleshooting, future modifications, and upgrades.
- Manage the Reports.dic File: The
Reports.dicfile can grow quite large if you have many modifications. Consider having a strategy for managing it, including regular backups and potentially splitting modifications across multiple.dicfiles if you have customizations from different sources or for different purposes (though this is less common). - Test Thoroughly: After modifying a report, test it comprehensively with different data scenarios to ensure the calculated fields display the correct string labels for all possible integer values. Test with edge cases if applicable.
- Consider Upgrades: Dynamics GP upgrades often involve migrating or recreating modified reports. Having clear documentation and clean modifications will make this process much easier. Some modifications might become obsolete if standard GP functionality changes.
- Utilize Roles for Security: Assigning security to roles instead of individual users significantly simplifies administration, especially as your user base changes.
Expanding Report Capabilities¶
Beyond simple string display, Report Writer offers many capabilities. You can combine the technique described here with conditional formatting, grouping, sorting, and other calculated fields to create sophisticated and informative reports. The ability to display clear, descriptive labels for option selections is just one foundational step in creating reports that are intuitive and easy for users to understand and utilize.
For those looking to deepen their knowledge of Dynamics GP Report Writer, Microsoft’s official documentation (available through the Software Development Kit or SDK) is a comprehensive resource. Additionally, various online communities and platforms like YouTube often host tutorials and discussions on specific Report Writer techniques. Searching for “Dynamics GP Report Writer tutorial” or “using calculated fields in Report Writer” can yield helpful visual guides and tips from experienced users and consultants.
Conclusion¶
Converting integer representations of radio groups into descriptive string labels is a fundamental report customization often required in Microsoft Dynamics GP. By leveraging the RW_Token user-defined function within Report Writer and correctly preparing the integer input, you can significantly enhance the readability and usefulness of your reports. Following the detailed steps for backing up your Reports.dic file, accessing Report Writer, creating and configuring the necessary calculated fields, and properly granting security will enable you to implement this essential modification successfully. Remember to test your changes and document them for future reference and maintenance. Empowering your users with clearer reports ultimately improves decision-making and system usability.
Do you have experience modifying reports in Dynamics GP? Have you used the RW_Token function for other purposes? Share your thoughts or challenges in the comments below!
Post a Comment