PdcApplication.RunScript: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
== Declaration ==
== Declaration ==
 
RunScript(ScriptName as String,ParamList as String) as String


== Description ==
== Description ==
 
Run a second script from current script


== Notes ==
== 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.<br />


'''Parameters Description'''<br />
ScriptName Name of the script to start<br />
ParamList A parameter string


== Code example ==
== 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.


<source lang="vb">
dim strParameters
dim strDNID


<source lang="vb">
  strDNID = pdc.ActiveObjectID
 
  pdc.ParamStr = strDNID  pdc.RunScript "SelectTransport", strDNID


  msgbox "For this delivery " & pdc.ParamStr & " is the cheapest option."
</source>
</source>


== Availability ==
== Availability ==
Available since November 2006 (From version 3.7).

Revision as of 11:13, 21 May 2012

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.

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).