I have a form with many values in filed.
I need a PAM flow caught these values (2,3,3,2,2,3), and sum all. I'm not getting contatenar the string 'qntdMaquinas' with the index value 1,2,3, etc to 'n'.
Example:
Process.sum= 0; while (existVM) { { Process.count = (Process.form."qntdMaquinas"+i) if(count == undefined){ break; } Process.sum=+ Process.count }
This was an example, which this not working.
Try this:
I think that your code is evaluating:
Process.form."qntdMaquinas" (which I don't think is technically a real thing)
And then trying to add "i" to it - But I suspect it probably fails before it tries to add 'i' to the result of that evaluation.
Switching over to Process.var["attr"] syntax lets you explicitly say "I want to get an attribute with the string value that I specify here" -
Process.var[(statement)] says : evaluate 'statement' before calling the attribute of 'Process.var' -
And lastly, I don't think JS necessarily needs it, but it's good practice to make sure that both values in your statement are definitely strings, so that JS knows to concatenate them instead of trying to sum them.