
Quote from javadrajabihakami on February 20, 2024, 3:36 pmHello and good time, dear friends, how to put a variable received from the program into a JavaScript code and process it, and then get the result! The desired code is attached! thanks all
Hello and good time, dear friends, how to put a variable received from the program into a JavaScript code and process it, and then get the result! The desired code is attached! thanks all
Uploaded files:
Quote from luishp on February 21, 2024, 12:58 pm@javadrajabihakami please try this instead:
CreateArray [numbers] 1,2,3,4,4,4,5,6,6,7,7,8 CreateEmptyArray [uniqueNumbers] BeginJS function unique(arr) { var result = []; for (var i = 0; i < arr.length; i++) { if (result.indexOf(arr[i]) === -1) { result.push(arr[i]); } } return result; } $App.uniqueNumbers = (unique($App.numbers)); EndJS jsAlert [uniqueNumbers]Regards.
@javadrajabihakami please try this instead:
CreateArray [numbers] 1,2,3,4,4,4,5,6,6,7,7,8
CreateEmptyArray [uniqueNumbers]
BeginJS
function unique(arr) {
var result = [];
for (var i = 0; i < arr.length; i++) {
if (result.indexOf(arr[i]) === -1) {
result.push(arr[i]);
}
}
return result;
}
$App.uniqueNumbers = (unique($App.numbers));
EndJS
jsAlert [uniqueNumbers]
Regards.

Quote from javadrajabihakami on February 21, 2024, 7:45 pmHello and good time, thank you for your reply, dear teacher! The code works well! But my variable is a string type and I can't convert it into an array! Thank you for a guide in this regard! thanks again
Hello and good time, thank you for your reply, dear teacher! The code works well! But my variable is a string type and I can't convert it into an array! Thank you for a guide in this regard! thanks again

Quote from luishp on February 21, 2024, 11:06 pmHi @javadrajabihakami
But my variable is a string type and I can't convert it into an array!
Sorry, I don't understand you. Please explain in detail. I have just edited your code.
Regards.
But my variable is a string type and I can't convert it into an array!
Sorry, I don't understand you. Please explain in detail. I have just edited your code.
Regards.

Quote from javadrajabihakami on February 21, 2024, 11:44 pmHello again, I want to get my array from a string variable! But I do not succeed!
In the attached example, I defined a variable that has a number with the accepted array format!
And I want to use this in the sample code! But I will not succeed!
Hello again, I want to get my array from a string variable! But I do not succeed!
In the attached example, I defined a variable that has a number with the accepted array format!
And I want to use this in the sample code! But I will not succeed!
Uploaded files:
Quote from javadrajabihakami on February 21, 2024, 11:55 pmSorry, this is my problem! I can't set this variable for the array
Sorry, this is my problem! I can't set this variable for the array
Uploaded files:
Quote from luishp on February 22, 2024, 7:10 pm@javadrajabihakami Still not sure, but I think what you are looking for is StrParse command. It's used to convert a string with comma (or any other character) separated values into an Array.
Am I right?
@javadrajabihakami Still not sure, but I think what you are looking for is StrParse command. It's used to convert a string with comma (or any other character) separated values into an Array.
Am I right?

Quote from javadrajabihakami on February 22, 2024, 7:34 pmThank you for your reply dear friend! Yes, with this order, I managed to separate them! I am looking for a code that can remove duplicate elements from the array! I haven't succeeded yet! My array is of string type! And the previous code that you sent, I think it only worked with a good number!
Thank you for the help you have attached to this example. Thank
Thank you for your reply dear friend! Yes, with this order, I managed to separate them! I am looking for a code that can remove duplicate elements from the array! I haven't succeeded yet! My array is of string type! And the previous code that you sent, I think it only worked with a good number!
Thank you for the help you have attached to this example. Thank

Quote from luishp on February 24, 2024, 11:30 am@javadrajabihakami But, it's just the same! Check this code:
SetVar [string] "one,one,two,two,two,three,four,four,four,four,five,six,seven,eight,nine,ten" StrParse "[string]" "," [myArray] CreateEmptyArray [uniqueStrings] BeginJS function unique(arr) { var result = []; for (var i = 0; i < arr.length; i++) { if (result.indexOf(arr[i]) === -1) { result.push(arr[i]); } } return result; } $App.uniqueStrings = (unique($App.myArray)); EndJS jsAlert [uniqueStrings]
@javadrajabihakami But, it's just the same! Check this code:
SetVar [string] "one,one,two,two,two,three,four,four,four,four,five,six,seven,eight,nine,ten"
StrParse "[string]" "," [myArray]
CreateEmptyArray [uniqueStrings]
BeginJS
function unique(arr) {
var result = [];
for (var i = 0; i < arr.length; i++) {
if (result.indexOf(arr[i]) === -1) {
result.push(arr[i]);
}
}
return result;
}
$App.uniqueStrings = (unique($App.myArray));
EndJS
jsAlert [uniqueStrings]

Quote from javadrajabihakami on February 24, 2024, 9:53 pmHello and good time, dear teacher, thank you for your kindness! This was exactly the code I wanted! Thank you very much! works well...
Hello and good time, dear teacher, thank you for your kindness! This was exactly the code I wanted! Thank you very much! works well...