
During the Dexterity Fundaments Bootcamp training, which was run in the week prior to the Community Summit 2023 conference, one of the attendees came up with an issue using the Multicurrency Access Setup window in Microsoft Dynamics GP.
Their problem is that the list of companies shown on the right-hand scrolling windows are unsorted and the customer has over 300 companies. This makes using this window extremely frustrating and slow. They already owned GP Power Tools and wanted to use it for a fix.
Technically, the company scrolling windows are sorted, but using the first key on the Company Master (SY01500) SY_Company_MSTR table which is the Company ID field. This means the companies are listed in the order they were created, which is not really useful to anyone once you have more than about 10 companies.
Fixing the problem is very simple as the SY_Company_MSTR table already has its second index based on Company Name. All we need to do is add a couple of triggers to re-fill the scrolling windows using key 2 after the underlying core code fills them without defining the key (so it uses key 1).
Here is the Project Setup window showing the two triggers:
The triggers are on the ‘Currencies LB’ and ‘Exchange Tables LB’ listbox field change events running after the original code. Their handler scripts can just issue the fill window command with the additional by number 2 clause.
MC_ACCESS_SORT_01 Trigger Script
[code]in string IN_OldValue;
in string IN_NewValue;
out boolean OUT_Condition;
OUT_Condition = false;
if isopen(form MC_Access) then
fill window MC_Currency_Access_SCROLL of form MC_Access by number 2;
if not empty(countitems(‘Exchange Tables LB’ of window MC_Access of form MC_Access)) then
fill window MC_Currency_Access_SCROLL of form MC_Access by number 2;
end if;
OUT_Condition = true;
end if;
[/code]
MC_ACCESS_SORT_02 Trigger Script
[code]in string IN_OldValue;
in string IN_NewValue;
out boolean OUT_Condition;
OUT_Condition = false;
if isopen(form MC_Access) then
fill window MC_Exchange_Table_Access_SCROLL of form MC_Access by number 2;
OUT_Condition = true;
end if;
[/code]
Downloading and Installing
Download the example code, import using the Project Setup window (now possible for first time imports with Build 28.8 onwards), or use Configuration Export/Import window (for older builds):
The code will be active on next login or after switching companies, or you can use start the triggers manually from the Project Setup window.
More Information
For more information see:
- GP Power Tools Portal: http://winthropdc.com/GPPT
- GP Power Tools Samples: http://winthropdc.com/GPPT/Samples
- GP Power Tools Videos: http://winthropdc.com/GPPT/Videos
Hope you find this quick sample helpful.
David
This article was originally posted on http://www.winthropdc.com/blog.

