Assigns a value to a global Newlook variable or a Newlook object property.
Newlook Smartclient
Newlook Server
object.SetValue(name, value)
Where object is an object expression that evaluates to one of the items in the Applies To list below.
The SetValue method syntax has these parameters:
Part |
Description |
name |
String. String expression that specifies the name of the Newlook variable which is to be assigned. If a name is specified, but a variable by that name does not already exist, Newlook will automatically create an instance of the variable. |
value |
Variant. Expression that specifies the value which will be calculated and assigned to the variable. Value may be any combination of literal, constant and function calls, which comprise a valid expression. |
No returns.
This method is useful when you want to assign a value to a variable for reuse within your Newlook solution or for debugging in Inspector.
The following JScript saves the current username in the variable "User":
// Retrieve username from screen and save as Newlook variable
var user = App.ActiveForm.Username.Text;
App.SetValue ("User", user);
The following JScript uses the substr function to extract a department code from the Username and assign it to the variable "Department":
// Retrieve user id from screen and save department prefix as a Newlook variable
var UserID = App.ActiveForm.Username.Text;
App.SetValue ("Department", UserID.substr(0,3));
The following JScript creates a Newlook array containing three elements: a string, integer and user defined element.
App.SetValue("myArray", [ "one", 2, {number: "three"}]);
The following JScript uses the Http.Get method to return an array and assign it to a Newlook variable array:
// Example return data
// var data =
// [
// { Id: "P3234", Description: "Spoke", Available: 7000 },
// { Id: "P7534", Description: "Rod", Available: 6000 },
// { Id: "P9533", Description: "Widget", Available: 458 }
// ];
// read inputs from the active form
var varMake = App.ActiveForm.inputMake.Text;
var varModel = App.ActiveForm.inputModel.Text;
var varYear = new Number(App.ActiveForm.inputYear.Text);
var partsArray = Http.Get("http://localhost/mycars/GetParts", { make: varMake, model: varModel, year: varYear });
// No conversion required to store returned value
App.SetValue("vCarParts", partsArray);
The following JScript creates a Newlook user defined type record, the third argument being an array:
App.SetValue("myRecord", { arg1: "one", arg2: 2, arg3: [3]});
© 2004-2021 looksoftware. All rights reserved.