Plays a transaction from the Transactions collection.
App.PlayTransaction(Transaction, [Inputs])
Newlook Smartclient
Newlook Server
Transaction - (String, Required)
A string specifying the name of the transaction to play.
Inputs - (String, Optional)
Inputs to the transaction can be supplied in one of two ways:
This method returns a VB Array. If you are using this method in a JScript script then you will need to convert the returned value from a VB to JScript array using the toArray() method. See the JScript examples below.
If method (1) above is used, then the return value is an array of string
values (corresponding to the output fields in the order they are defined
within the transaction). If method(2) above is chosen, then the return
value is an array of strings of the form “OutputFieldName=value”
(where OutputFieldName
is the name of the output field and Value
is the string contents of that output field). In this case, it is up to
the calling script to extract the value following the ‘=’ symbol.
VB SCRIPT:1. In this example we are passing the 'EditEmail' transaction two arguments using method 1. The PlayTrasaction method will return a VB array containing the three outputs from the transaction: Dim Paramtopass1 Dim Paramtopass2
Paramtopass1 = app.GetValue("CustomerNumber") Paramtopass2 = app.GetValue("CustomerEmail")
result = App.PlayTransaction ("EditEmail",Paramtopass1,Paramtopass2)
App.MsgBox "Status: " & result(0) & " New Email: " & result(1) & " Member Points: " & result(2), "Update Status:"
2. In this example we are passing the 'EditEmail' transaction two arguments using the values method. The PlayTransaction method will return a VB array containing the three outputs from the transaction in the form of input=val: Dim returnMsg Dim returnEmail Dim returnPoints
result = App.PlayTransaction ("EditEmail", "CustomerID=2" , "[email protected]")
returnMsg = Right(result(0),(Len(result(0))-8)) returnEmail = Right(result(1),(Len(result(1))-6)) returnPoints = Right(result(2),3)
App.MsgBox "Status: " & returnMsg & ", New Email: " & returnEmail & " Member Points: " & returnPoints & ".", "Update Status:"
JSCRIPT:1. In this example we are passing the 'EditEmail' transaction two arguments using method 1. The PlayTransaction method will return a VB array (containing the three outputs from the transaction) which is converted to a JScript array and displayed in a message box: var Paramtopass1 = app.GetValue("CustomerNumber"); var Paramtopass2 = app.GetValue("CustomerEmail");
var result = App.PlayTransaction ("EditEmail",Paramtopass1,Paramtopass2); var returnArray = result.toArray();
App.MsgBox (returnArray[0] + ", New Email: " + returnArray[1] + ", Points: " + returnArray[2] + ".", "result", 0, 0);
2. In this example we are passing the 'EditEmail' transaction two arguments using method 2. The PlayTransaction method will return a VB array containing the three output from the transaction which is then converted to a JScript array and displayed in a message box: var result = App.PlayTransaction ("EditEmail", "CustomerID=2" , "[email protected]");
var returnArray = result.toArray(); var returnMsg = returnArray[0]; var returnEmail = returnArray[1]; var returnPoints = returnArray[2];
App.MsgBox (returnMsg.slice(8,returnMsg.length) + ", New Email: " + returnEmail.slice(6,returnEmail.length) + ", Points: " + returnPoints.substr(returnPoints.length-3,returnPoints.length) + ".", "result", 0, 0); |
Methods | Transaction Recorder | Transaction object | Transactions Collection
© 2004-2021 looksoftware. All rights reserved.