Quote from llazzari on October 9, 2021, 7:48 pmGOOD MORNING
I HAVE A PROBLEM WITH THE CREATION OF
OF ARRAY, I TESTED IN DIFFERENT WAYS, FOLLOWING THE INSTRUCTIONS OF THE GUIDE AND THE FORUM BUT IT DOESN'T WORK.
FOR EXAMPLE BY INSERTING ONLY ONE ELEMENT IN THE ARRAY IT WORKS, WHEN I INSERT MORE ELEMENTS IT DOESN'T WORK, I NEED TO KNOW THE CORRECT SYNTAX TO USE.
THANK YOU
GOOD MORNING
I HAVE A PROBLEM WITH THE CREATION OF
OF ARRAY, I TESTED IN DIFFERENT WAYS, FOLLOWING THE INSTRUCTIONS OF THE GUIDE AND THE FORUM BUT IT DOESN'T WORK.
FOR EXAMPLE BY INSERTING ONLY ONE ELEMENT IN THE ARRAY IT WORKS, WHEN I INSERT MORE ELEMENTS IT DOESN'T WORK, I NEED TO KNOW THE CORRECT SYNTAX TO USE.
THANK YOU
Quote from llazzari on October 9, 2021, 8:53 pmHi Gaev
HOW IT WORKS
CreateArray [prova] "A "
-------------------------------------------------
THIS DOES NOT WORK
CreateArray [prova] "A,B,C "
Hi Gaev
HOW IT WORKS
CreateArray [prova] "A "
-------------------------------------------------
THIS DOES NOT WORK
CreateArray [prova] "A,B,C "
Quote from llazzari on October 9, 2021, 8:53 pmHi Gaev
HOW IT WORKS
CreateArray [prova] "A "
-------------------------------------------------
THIS DOES NOT WORK
CreateArray [prova] "A,B,C "
Hi Gaev
HOW IT WORKS
CreateArray [prova] "A "
-------------------------------------------------
THIS DOES NOT WORK
CreateArray [prova] "A,B,C "
Quote from llazzari on October 9, 2021, 9:08 pmCreateArray [prov] "A "
If [RISP] = "[prov]"
MoveObject "Container3" "120px" "24px"
EndifA CONTAINER
ONE INPUT BOX
ONE BUTTON
CreateArray [prov] "A "
If [RISP] = "[prov]"
MoveObject "Container3" "120px" "24px"
Endif
A CONTAINER
ONE INPUT BOX
ONE BUTTON
Quote from Gaev on October 10, 2021, 3:54 am@llazzari
THIS DOES NOT WORK
CreateArray [prova] "A,B,C "It does work ... try and follow it with ...
AlertBox "Element0" "[prova(0)]" ""I think the reason you think it is not working is because of your command ...
If [RISP] = "[prov]"
... I don't know what [RISP] is, but you can't compare array contents like this ... also, your array is named [prova], but the If command says [prov].
What do you really want to compare ?
THIS DOES NOT WORK
CreateArray [prova] "A,B,C "
It does work ... try and follow it with ...
AlertBox "Element0" "[prova(0)]" ""
I think the reason you think it is not working is because of your command ...
If [RISP] = "[prov]"
... I don't know what [RISP] is, but you can't compare array contents like this ... also, your array is named [prova], but the If command says [prov].
What do you really want to compare ?
Quote from llazzari on October 10, 2021, 12:57 pmThanks Gaev, my intent was to compare a value inserted in a text input (variable [resp]) with the values of the elements of the array [prov], I insisted on this method because inserting only one element in the array [prov ] confirmed the correspondence, but with more values in the array this did not work, I could not understand why, now I have used this method and it works
CreateArray [prov] "A, B, C"Loop 0 2 [N]
If [RISP] = "[prov ([N])]"
AlertBox "Element0" "[prov ([N])]" ""
MoveObject "Container3" "120px" "24px"
Endif
EndLoopHello, good day
Thanks Gaev, my intent was to compare a value inserted in a text input (variable [resp]) with the values of the elements of the array [prov], I insisted on this method because inserting only one element in the array [prov ] confirmed the correspondence, but with more values in the array this did not work, I could not understand why, now I have used this method and it works
CreateArray [prov] "A, B, C"
Loop 0 2 [N]
If [RISP] = "[prov ([N])]"
AlertBox "Element0" "[prov ([N])]" ""
MoveObject "Container3" "120px" "24px"
Endif
EndLoop
Hello, good day
Quote from Gaev on October 10, 2021, 3:47 pm@llazzari
inserting only one element in the array [prov ] confirmed the correspondence, but with more values in the array this did not work, I could not understand why
I do not know the internals of the If command, but when you had just one element, it might have viewed [prov] as a simple variable (instead of an array with one element).
The Loop/EndLoop is the proper way to sequence through each of the elements.
Note that you can search through the loop a bit faster by using ExitLoop inside the If/EndIf code block ... details can be found here
inserting only one element in the array [prov ] confirmed the correspondence, but with more values in the array this did not work, I could not understand why
I do not know the internals of the If command, but when you had just one element, it might have viewed [prov] as a simple variable (instead of an array with one element).
The Loop/EndLoop is the proper way to sequence through each of the elements.
Note that you can search through the loop a bit faster by using ExitLoop inside the If/EndIf code block ... details can be found here