#GPPT Automating or Customizing the Report Destination Window


David Meego - Click for blog homepageAs promised, following on from the previous article: #Dexterity Automating or Customizing the Report Destination Window, this article shows how you can achieve the automating of the Report Destination dialogs using GP Power Tools – Development Tools module, including the dialogs in the Dexterity Runtime Engine.

GP Power Tools has the ability to create triggers for all the events that Dexterity can plus a number of additional events. It can reference all installed product dictionaries, but also can reference the Dexterity Runtime Engine, DEX.DIC.

To ask GP Power Tools to include the Runtime Engine in its triggering and scripting windows, please add the following Dex.ini setting to the workstations you are using to create the customization:

  • MBS_Debug_ShowRuntime=TRUE

Once this setting has been added, the DEX.DIC will be available in the Trigger Setup and Runtime Execute Setup windows and shows in the Resource Explorer windows.

Using the Trigger Setup window we can create the same three triggers as the Dexterity example. Note the Do not activate Logging Mode and Minimize Log Entries checkboxes are selected to so that the triggers run with a minimum of overhead. There is no need to capture logs or log when the trigger fires (unless debugging).


Trigger 1 – DEX.DIC Report Ask window – Resource Tab


Trigger 1 – DEX.DIC Report Ask window – Script Tab


Trigger 2 – DEX.DIC Report Destination window – Resource Tab


Trigger 2 – DEX.DIC Report Destination window – Script Tab


Trigger 3 – Dynamics.dic Report_Destination window – Resource Tab


Trigger 3 – Dynamics.dic Report_Destination window – Script Tab

These examples were created in Build 28 (coming soon), which is why the default form and default window commands have been automatically added. Using these commands means that you can refer to the Cancel Button without needing to fully qualify the resource with the “of window” and “of form” descriptors.

Here are the three trigger scripts:

AUTO_REPORT1 Trigger Script

out boolean OUT_Condition;

OUT_Condition = false;

{ Comment out default to statements and fully qualify fields }
{ if needing access to tables not attached to the form }
default form to 'Report Ask';
default window to 'Report Type';

if isopen(form 'Report Ask') then
	run script '(L) Cancel';
	OUT_Condition = true;
end if;

AUTO_REPORT2 Trigger Script

out boolean OUT_Condition;

OUT_Condition = false;

{ Comment out default to statements and fully qualify fields }
{ if needing access to tables not attached to the form }
default form to 'Report Destination';
default window to 'Report Type';

if isopen(form 'Report Destination') then
	run script '(L) Cancel';
	OUT_Condition = true;
end if;

AUTO_REPORT3 Trigger Script

out boolean OUT_Condition;

OUT_Condition = false;

{ Comment out default to statements and fully qualify fields }
{ if needing access to tables not attached to the form }
default form to Report_Destination;
default window to Report_Destination;

if isopen(form Report_Destination) then
	run script 'Cancel Button';
	OUT_Condition = true;
end if;

Controlling when the triggers are active can be handled by using GP Power Tools Helper Functions to either start and start the triggers when needed. For example:

call with name "MBS_Trigger_Start" in dictionary 5261, "AUTO_REPORT1";

{ Add code that runs a report here }

call with name "MBS_Trigger_Stop" in dictionary 5261, "AUTO_REPORT1";

However, best practice is to not continuously start and stop the triggers as this will use up trigger tags. If you need more control, enable the triggers on startup and use GP Power Tools Parameter Helper Functions to check if the script should be aborted. You can use use either the Table based parameter helper functions or the new, faster memory based parameters helper functions (added in the upcoming build 28).

For example: using a boolean memory variable which we have named “Cancel Report” which needs to be set to true in another script.


local boolean MBS_Memory_Boolean;

call with name "MBS_Memory_Get_Boolean" in dictionary 5261, "Cancel Report", MBS_Memory_Boolean;

if not MBS_Memory_Boolean then
	abort script;
end if;


Help you find these examples useful.

David

This article was originally posted on http://www.winthropdc.com/blog.

Please post feedback or comments

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

WordPress.com Logo

You are commenting using your WordPress.com 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.