setAttribute
Description
Sets an object’s attribute.
Input / Parameter
object
The object to set attribute for.
Object
-
-
Yes
attribute
The attribute to set.
String
-
-
Yes
value
The value to set for the attribute.
Any
-
-
Yes
Output
Returns true or false.
Boolean
Example
In this example, we will add new attribute to an object and check the resulting object in the console.
Step
Drag a
buttoncomponent into the canvas and open theActiontab. Select thepressevent of the button.
Drag the
Variable.setfunction to the event flow and change it'snameparam value tooriginalObject, and it'svalueparam type to funtion / subflow. Insidevaluesubflow addConversion.toObjectfunction and add two new paremetervalue1andvalue2with their value asval1andval2.
Back to the main flow add the
Object.setAttributefunction, on it'sattributeandvalueparam addnewValueas a value for both of them and change it'sobjectparameter type to a function / subflow, inside it drag aVariable.getfunction and then fill it'snameparam value withoriginalObject.
Back to the main flow add the
Log.writefunction and change it'svalueparameter type to a function / subflow, inside it drag aObject.getAttributefunction and then fill it'sattributeparam value withnewValueas for it'sobjectparam, change the param type into a function / subflow and add theVarable.getfunction inside, on it'snameparam addoriginalObjectas the value.
Result
This steps will show us the updated object attribute based on it's new parameter and value on the console.

Related Information
See also
Last updated