12-03-2023, 08:58 PM
(This post was last modified: 12-03-2023, 08:59 PM by iliaslamprou.)
Hi,
you have to add a java script code.
1. Read all the variables from the script.
2. Convert the alues to characters
3. Create a text from the charactes.
4. Write the text to a new Variable
Please check the attached image. I have created an example.
In this example the variables V1-V5 contains the numbers 65,66,67,68,69
The result to V10 is the text: ABCDE
you have to add a java script code.
1. Read all the variables from the script.
2. Convert the alues to characters
3. Create a text from the charactes.
4. Write the text to a new Variable
Please check the attached image. I have created an example.
In this example the variables V1-V5 contains the numbers 65,66,67,68,69
The result to V10 is the text: ABCDE
Code:
//--- Copy values from Virtuino Variables to JavaScript variables
var inputValue1 =+Virtuino.readValue("inputTag1"); //Read inputTag1 value as number from V1.
var inputValue2 =+Virtuino.readValue("inputTag2"); //Read inputTag2 value as number from V2
var inputValue3 =+Virtuino.readValue("inputTag3"); //Read inputTag3 value as number from V3
var inputValue4 =+Virtuino.readValue("inputTag4"); //Read inputTag4 value as number from V4
var inputValue5 =+Virtuino.readValue("inputTag5"); //Read inputTag5 value as number from V5
//--- enter the JavaScript code like the example below
var char1 = String.fromCharCode(inputValue1);
var char2 = String.fromCharCode(inputValue2);
var char3 = String.fromCharCode(inputValue3);
var char4 = String.fromCharCode(inputValue4);
var char5 = String.fromCharCode(inputValue5);
var text = char1+char2+char3+char4+char5;
result = '{"tag":"outputTag", "value":"'+ text+ '"}'; // return a json message