Page History
...
| Wiki Markup |
|---|
Reading values
Scripts can read values from the instance list like this:
myVariable = objListManager.Akey3\[0\];
See [<span style="color: #0000ee"><span style="text-decoration: underline; ">Visual and Programmatic Identifiers</span></span>|lansa050_2275.htm#_Ref132604343].
If the user has selected several entries in the instance list, you can read all the values in a loop like this:
var i = 0; var strMessage = ""; for (i = 1; i <= objListManager.TotalSelected; i++) \{ strMessage += "Selected Employee " + objListManager.AKey3\[i\] + " "; \} alert(strMessage);
Or from a field defined on a 5250 screen like this:
MyVariable = GETVALUE("utxtEmployeeCode");
Writing values
The script can put values on the screen like this:
SETVALUE("utxtEmployeeCode", "myText");
Storing values
You can store values in Javascript variables and then read and write from them:
Var MyString = ""; MyString = objListManager.Akey3\[0\];
These variables exist only while the script is running. To share information between scripts, you need to create and set a property for [<span style="color: #0000ee"><span style="text-decoration: underline; ">objGlobal </span></span>|lansa050_2440.htm#_Ref130186083]:
objGlobal.uLastValue = "anything";
Then another script can read this value:
myVariable = objGlobal.uLastValue;
Getting script pieces quickly
[<span style="color: #0000ee"><span style="text-decoration: underline; ">Scripting Pop-up Menu</span></span> |lansa050_1530.htm#_Ref132605186]
[<span style="color: #0000ee"><span style="text-decoration: underline; ">Show Contents List</span></span>|../../index.htm#lansa/lansa050_2230.htm] |