Quote from Gustavo1973 on May 19, 2019, 6:11 pmintento crear una variable combinada y asignarle un valor pero obtengo como resultado "Indefinida" en esa variable si la llamo con un Alertbox para ver que contiene:
SetVar [Cantidad([cont])] [Cantidad]
Donde:
cont : 1
[Cantidad] : Se ingresa mediante un Input de texto
intento crear una variable combinada y asignarle un valor pero obtengo como resultado "Indefinida" en esa variable si la llamo con un Alertbox para ver que contiene:
SetVar [Cantidad([cont])] [Cantidad]
Donde:
cont : 1
[Cantidad] : Se ingresa mediante un Input de texto

Quote from luishp on May 19, 2019, 6:18 pm@gustavo1973, lo que llamas variables combinadas en VisualNEO Web son objetos.
La sintaxis correcta sería así:CreateEmptyObject [objCantidad] SetVar [objCantidad([cont])] [cantidad] AlertBox "Valor:" "[objCantidad([cont])]" ""Fíjate que no puedes tener un objeto ni un array con el mismo nombre que una variable.
Más información aquí:
https://webhelp.visualneo.com/JSON.html
@gustavo1973, lo que llamas variables combinadas en VisualNEO Web son objetos.
La sintaxis correcta sería así:
CreateEmptyObject [objCantidad] SetVar [objCantidad([cont])] [cantidad] AlertBox "Valor:" "[objCantidad([cont])]" ""
Fíjate que no puedes tener un objeto ni un array con el mismo nombre que una variable.
Más información aquí:
https://webhelp.visualneo.com/JSON.html
Quote from Gustavo1973 on May 19, 2019, 6:33 pmBuenisimo, ahi me funciono
Puede ese objecto creado almacenar un valor no numerico? un texto?
Buenisimo, ahi me funciono
Puede ese objecto creado almacenar un valor no numerico? un texto?

Quote from luishp on May 19, 2019, 9:52 pmPuede ese objecto creado almacenar un valor no numerico? un texto?
¡Pues claro! Incluso puede almacenar otro objeto, o un Array... también puedes utilizar objetos bidimensionales.
Hay varios ejemplos relacionados con el plugin neoTable donde se utilizan objetos más complejos.
Puede ese objecto creado almacenar un valor no numerico? un texto?
¡Pues claro! Incluso puede almacenar otro objeto, o un Array... también puedes utilizar objetos bidimensionales.
Hay varios ejemplos relacionados con el plugin neoTable donde se utilizan objetos más complejos.

Quote from Vadim on May 25, 2019, 4:17 pmGood day! I have a similar question.
What this code (VisualNEO Win) should look like in VisualNEO Web?
Loop "1" "30" "[i]"
If "[RadioGroup[i]]" "=" ""
AlertBox "Attention!" "Ignored question number [i]. || Please answer..."
EndIf
EndLoop
Good day! I have a similar question.
What this code (VisualNEO Win) should look like in VisualNEO Web?
Loop "1" "30" "[i]"
If "[RadioGroup[i]]" "=" ""
AlertBox "Attention!" "Ignored question number [i]. || Please answer..."
EndIf
EndLoop
Quote from Gaev on May 25, 2019, 5:11 pm@vadim:
What this code (VisualNEO Win) should look like in VisualNEO Web?
Let us assume that you created an array of answers like ...
CreateEmptyObject [RadioGroup] SetVar [RadioGroup(0) ] "Donald" SetVar [RadioGroup(1) ] "Duck" SetVar [RadioGroup(2) ] "USA" SetVar [RadioGroup(3) ] "" etc. etc. SetVar [RadioGroup(29) ] "Pinochio"... then, if you want to check that every array item is present ...
Loop "0" "29" "[i]" If "[RadioGroup([i])]" "=" "" AlertBox " Attention! " "Ignored question number [i]. || Please answer ..." EndIf EndLoop
@vadim:
What this code (VisualNEO Win) should look like in VisualNEO Web?
Let us assume that you created an array of answers like ...
CreateEmptyObject [RadioGroup] SetVar [RadioGroup(0) ] "Donald" SetVar [RadioGroup(1) ] "Duck" SetVar [RadioGroup(2) ] "USA" SetVar [RadioGroup(3) ] "" etc. etc. SetVar [RadioGroup(29) ] "Pinochio"
... then, if you want to check that every array item is present ...
Loop "0" "29" "[i]"
If "[RadioGroup([i])]" "=" ""
AlertBox " Attention! " "Ignored question number [i]. || Please answer ..."
EndIf
EndLoop

Quote from Vadim on May 26, 2019, 11:39 amThank you very much!
It turns out that the Radiogroup variables must be created in advance with an index in brackets. For example, [RadioGroup(1)], [RadioGroup(2)], [RadioGroup(3)]...
So that later they can be used in the cycle Loop [RadioGroup([i])].
I understand correctly?
Thank you very much!
It turns out that the Radiogroup variables must be created in advance with an index in brackets. For example, [RadioGroup(1)], [RadioGroup(2)], [RadioGroup(3)]...
So that later they can be used in the cycle Loop [RadioGroup([i])].
I understand correctly?
Quote from Gaev on May 26, 2019, 7:37 pm@vadim:
It turns out that the Radiogroup variables must be created in advance with an index in brackets.
So that later they can be used in the cycle Loop [RadioGroup([i])].
I understand correctly?I was merely responding to your enquiry about the equivalent of array/compound variables in VisualNEO Win (NeoBook).
With VisualNEO Web, you deal with arrays and reference each item in the array by wrapping it in round brackets.
So yes, you have to create this array using CreateEmptyObject.
However, you do not have to create individual items in advance; but you can setup the items using the same Loop/EndLoop block ... instead of ...
If "[RadioGroup([i])]" "=" ""... use ...
SetVar [RadioGroup(i)] "" OR SetVar [RadioGroup(i)] "--unanswered--"
@vadim:
It turns out that the Radiogroup variables must be created in advance with an index in brackets.
So that later they can be used in the cycle Loop [RadioGroup([i])].
I understand correctly?
I was merely responding to your enquiry about the equivalent of array/compound variables in VisualNEO Win (NeoBook).
With VisualNEO Web, you deal with arrays and reference each item in the array by wrapping it in round brackets.
So yes, you have to create this array using CreateEmptyObject.
However, you do not have to create individual items in advance; but you can setup the items using the same Loop/EndLoop block ... instead of ...
If "[RadioGroup([i])]" "=" ""
... use ...
SetVar [RadioGroup(i)] "" OR SetVar [RadioGroup(i)] "--unanswered--"

Quote from luishp on May 26, 2019, 9:59 pmI think it's interesting to mention here that using a bit of JavaScript can be very convenient when using variables whose name is composed from the concatenation of strings or other variable values.
Take a look at this sample:Loop "1" "30" "[i]" BeginJS if($App["RadioGroup"+$App.i] == ""){ alert("Attention!" "Ignored question number "+$App.i+" \n Please answer..."); } EndJS EndLoopSo, from JavaScript using
$App.myvarwill get the [myvar] NeoScript variable value.
Also this$App["myvar"]or this$App["my"+"var"]will do the same.
And also this:mystring="var"; $App["my"+mystring]=myvalue;
I think it's interesting to mention here that using a bit of JavaScript can be very convenient when using variables whose name is composed from the concatenation of strings or other variable values.
Take a look at this sample:
Loop "1" "30" "[i]"
BeginJS
if($App["RadioGroup"+$App.i] == ""){
alert("Attention!" "Ignored question number "+$App.i+" \n Please answer...");
}
EndJS
EndLoop
So, from JavaScript using $App.myvarwill get the [myvar] NeoScript variable value.
Also this $App["myvar"] or this $App["my"+"var"] will do the same.
And also this:
mystring="var"; $App["my"+mystring]=myvalue;

Quote from luishp on May 27, 2019, 6:34 am@vadim @gaev @gustavo1973 I have been thinking on this and I think it's possible to reprogram SetVar command so it behave exactly as in VisualNEO Win regarding compound variables.
Will do some experiments and let you know.
Best regards.
@vadim @gaev @gustavo1973 I have been thinking on this and I think it's possible to reprogram SetVar command so it behave exactly as in VisualNEO Win regarding compound variables.
Will do some experiments and let you know.
Best regards.

Quote from Vadim on May 27, 2019, 6:51 am@gaev, @luishp, thank you very much!
I have been thinking on this and I think it's possible to reprogram SetVar and GetVar commands so they behave exactly as in VisualNEO Win regarding compound variables.
Oh, it will be great!!
@gaev, @luishp, thank you very much!
I have been thinking on this and I think it's possible to reprogram SetVar and GetVar commands so they behave exactly as in VisualNEO Win regarding compound variables.
Oh, it will be great!!

Quote from luishp on May 28, 2019, 1:04 pm@gaev, @vadim, @gustavo1973 I have created a sample app with neoSetVar and neoGetVar subroutines to allow composed variables. You should use this syntaxis: [myvar(varB)(varC)] instead of [myvar[varB][varC]]
Please test it and let my know if it works as expected.
If so, I'm not sure if I should replace the current SetVar or create a new command.
What do you think?Thanks!!
FILE UPDATED 2019/05/30
@gaev, @vadim, @gustavo1973 I have created a sample app with neoSetVar and neoGetVar subroutines to allow composed variables. You should use this syntaxis: [myvar(varB)(varC)] instead of [myvar[varB][varC]]
Please test it and let my know if it works as expected.
If so, I'm not sure if I should replace the current SetVar or create a new command.
What do you think?
Thanks!!
FILE UPDATED 2019/05/30
Uploaded files:
Quote from Gaev on May 28, 2019, 4:18 pm@luishp:
1) It appears to work well; a good improvement for developers that are not comfortable using JSON/Array objects to store/access related information items.
2) Method of specification - in order to avoid confusing such variables with array/JSON items, instead of [prefix(suffixa)(suffixb)], I suggest one of ...
[prefix+suffixa+suffixb]
[prefix&suffixa&suffixb]
[prefix&&suffixa&&suffixb]
[prefix:suffixa:suffixb]3) Command name - in order to avoid breaking any existing Apps, I would not combine this into GetVar/SetVar ... best to give it a separate name that indicates that it is a complex specification where the variable name needs to be resolved first ... right now, the only catchy names I can think of are ...
GetCompositVar
GetComplexVar
GetSuperVar
GetSuffixedVar
GetDynamicVar
@luishp:
1) It appears to work well; a good improvement for developers that are not comfortable using JSON/Array objects to store/access related information items.
2) Method of specification - in order to avoid confusing such variables with array/JSON items, instead of [prefix(suffixa)(suffixb)], I suggest one of ...
[prefix+suffixa+suffixb]
[prefix&suffixa&suffixb]
[prefix&&suffixa&&suffixb]
[prefix:suffixa:suffixb]
3) Command name - in order to avoid breaking any existing Apps, I would not combine this into GetVar/SetVar ... best to give it a separate name that indicates that it is a complex specification where the variable name needs to be resolved first ... right now, the only catchy names I can think of are ...
GetCompositVar
GetComplexVar
GetSuperVar
GetSuffixedVar
GetDynamicVar
Quote from Gustavo1973 on May 28, 2019, 4:54 pmFunciona perfectamente,
Funciona perfectamente,

Quote from Vadim on May 29, 2019, 5:25 pmThe sample works great!
Will it work in the case of a cycle? (When a variable for a loop position is used inside a compound variable).
For example:Loop 1 20 [i] If [RadioGroup(i)] = "" AlertBox "Attention" "Missed question number [i]" "" EndIF EndLoop
It seems to me that if it is possible to leave the syntax of VisualNEO Win, it is better to leave it. This will simplify the transition of users from VisualNEO Win to VisualNEO Web.
The ideal option is to leave square brackets for compound variables. If we accept that variables are always in square brackets, then they should remain in square brackets also in compound variables. This syntax will not confuse the user.
The sample works great!
Will it work in the case of a cycle? (When a variable for a loop position is used inside a compound variable).
For example:
Loop 1 20 [i]
If [RadioGroup(i)] = ""
AlertBox "Attention" "Missed question number [i]" ""
EndIF
EndLoop
It seems to me that if it is possible to leave the syntax of VisualNEO Win, it is better to leave it. This will simplify the transition of users from VisualNEO Win to VisualNEO Web.
The ideal option is to leave square brackets for compound variables. If we accept that variables are always in square brackets, then they should remain in square brackets also in compound variables. This syntax will not confuse the user.

Quote from luishp on May 30, 2019, 9:02 amHi @vadim,
It should work this way:
Loop 1 20 [i] neoGetVar [tempvar] [RadioGroup(i)] If [tempvar] != "" AlertBox "Attention" "Missed question number [i]" "" EndIF EndLoopI need to ask Dave for help in order to use brackets as there is no way to use them right now.
I think the new commands should be called:
neoGetCompVar
neoSetCompVarGetCompVar
SetCompVarWhat do you think?
Hi @vadim,
It should work this way:
Loop 1 20 [i]
neoGetVar [tempvar] [RadioGroup(i)]
If [tempvar] != ""
AlertBox "Attention" "Missed question number [i]" ""
EndIF
EndLoop
I need to ask Dave for help in order to use brackets as there is no way to use them right now.
I think the new commands should be called:
neoGetCompVar
neoSetCompVar
GetCompVar
SetCompVar
What do you think?

Quote from Vadim on May 30, 2019, 10:40 amHi Luis!Maybe I'm doing something wrong.I attach an example. In the example I check - the user answered both questions or not.
1) For some reason, the variable [i] is one more than it should be.
2) Emptiness is apparently interpreted as zero. This prevents the logical condition from being met.*I do not see how to attach the file to the message. Made a link:
http://orgpsiholog.com/example/neosetvar.neoapp
I think the new commands should be called:
neoGetCompVar
neoSetCompVarIt seems to me that it is possible without a prefix:
GetCompVar
SetCompVar(But you know better.)
P.S.: There was an error in my message # 15, I have now replaced the "! =" Sign with the "=" sign.
I think the new commands should be called:
neoGetCompVar
neoSetCompVar
It seems to me that it is possible without a prefix:
GetCompVar
SetCompVar
(But you know better.)
P.S.: There was an error in my message # 15, I have now replaced the "! =" Sign with the "=" sign.

Quote from luishp on May 30, 2019, 10:49 pm@vadim please check the attached file.
There was an error in neoGetVar subroutine. I have updated the above sample file.
I have edited and simplified your sample too.P.S.: There was an error in my message # 15, I have now replaced the "! =" Sign with the "=" sign.
Note that in VisualNEO Web you should use "==" and not "=" as the last one will assign the value instead of comparing it.
@vadim please check the attached file.
There was an error in neoGetVar subroutine. I have updated the above sample file.
I have edited and simplified your sample too.
P.S.: There was an error in my message # 15, I have now replaced the "! =" Sign with the "=" sign.
Note that in VisualNEO Web you should use "==" and not "=" as the last one will assign the value instead of comparing it.
Uploaded files:
Quote from Vadim on May 31, 2019, 10:30 amLuis, thank you very much!
Your example works great!I just do not understand why the variable [i] at the end has a value one more than it should be.
If I understand correctly, after the end of the cycle, the variable for the position of the cycle should contain the same value as the one on which the cycle should be stopped (the second parameter of the Loop command).In my example, [i] should contain 2, but contains 3.
Luis, thank you very much!
Your example works great!
I just do not understand why the variable [i] at the end has a value one more than it should be.
If I understand correctly, after the end of the cycle, the variable for the position of the cycle should contain the same value as the one on which the cycle should be stopped (the second parameter of the Loop command).
In my example, [i] should contain 2, but contains 3.
Quote from Gaev on May 31, 2019, 3:43 pm@Vadim:
I placed this command just before the EndLoop ...
SetVar "[beforeEndLoop]" "[i]"... you will then see that [beforeEndLoop] ends up with a value of 2.
This suggests that ...
- the value of [i] is incremented in the EndLoop command
- then, control returns to the Loop command, where it compares [i] with the value in the second parameter; jumps to command after EndLoop if [i] > second parameter valueIt is because of javascript's implementations of the for loop ... I tried this example (modified from one in W3Schools) ...
var text = ""; var i; for (i = 0; i < 5; i++) { text += "The number is " + i + "<br>"; } text += "At End of Loop, the number is " + i + "<br>"; document.getElementById("demo").innerHTML = text;... at the end, it shows 5 (not 4).
This is a good thing when using ExitLoop inside the Loop/EndLoop block ... that way the value 5 (in example above) indicates that the loop was exited because the range was exhausted, while 4 would indicate that it was exited when i was 4.
@Vadim:
I placed this command just before the EndLoop ...
SetVar "[beforeEndLoop]" "[i]"
... you will then see that [beforeEndLoop] ends up with a value of 2.
This suggests that ...
- the value of [i] is incremented in the EndLoop command
- then, control returns to the Loop command, where it compares [i] with the value in the second parameter; jumps to command after EndLoop if [i] > second parameter value
It is because of javascript's implementations of the for loop ... I tried this example (modified from one in W3Schools) ...
var text = "";
var i;
for (i = 0; i < 5; i++) {
text += "The number is " + i + "<br>";
}
text += "At End of Loop, the number is " + i + "<br>";
document.getElementById("demo").innerHTML = text;
... at the end, it shows 5 (not 4).
This is a good thing when using ExitLoop inside the Loop/EndLoop block ... that way the value 5 (in example above) indicates that the loop was exited because the range was exhausted, while 4 would indicate that it was exited when i was 4.