PdcApplication.RunScript: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:
This method runs a script and returns the global pdc.ParamStr value.
This method runs a script and returns the global pdc.ParamStr value.
Specifically useful when the same logic is required in multiple user exits.<br />
Specifically useful when the same logic is required in multiple user exits.<br />
'''Note:''' The script that is started this way should NOT contain a Form Create procedure!!


'''Parameters Description'''<br />
'''Parameters Description'''<br />

Revision as of 14:51, 7 January 2013

Declaration

RunScript(ScriptName as String,ParamList as String) as String

Description

Run a second script from current script

Notes

This method runs a script and returns the global pdc.ParamStr value. Specifically useful when the same logic is required in multiple user exits.
Note: The script that is started this way should NOT contain a Form Create procedure!!

Parameters Description
ScriptName Name of the script to start
ParamList A parameter string

Code example

This code example starts as a userexit when closing a delivery note. The activeobjectID is therefore the Delivery Note ID. A separate script runs using this delivery note ID as a parameter. Once the separate script (SelectTransport) has finished and populated the global parameter string with the cheapest transport option, this can now be used again in the original script.

dim strParameters
dim strDNID

  strDNID = pdc.ActiveObjectID

  pdc.ParamStr = strDNID  pdc.RunScript "SelectTransport", strDNID

  msgbox "For this delivery " & pdc.ParamStr & " is the cheapest option."

Availability

Available since November 2006 (From version 3.7).