Once again your examples are incomplete. They do not actually work when I try to run them.
None the less I will try to explain what I think is going on.
Unless I completely misunderstand it, in your code JavaScript/HTML you are working with dynamically named variables that you are creating on the fly.
Progress has no such capability. Variables must be explicitly declared at compile time with something like:
Code:
define variable myVariable_1 as integer no-undo.
define variable myVariable_2 as integer no-undo.
and so forth.
There is absolutely no way to create or reference variables dynamically and there are no handles to variables. So you cannot iterate over a collection of variables and extract the value. Thus a snippet of code like this:
Code:
do i = 1 to 3:
messsage txtReferencia + string(i) + "_1":screen-value
view-as alert-box.
end.
is nonsense in a Progress program.
In Progress you _could_ create objects with properties using NEW and have handles to those but that does not appear to be what you are trying to do.
Or a temp-table could also be created dynamically with dynamic field names and you could then obtain handles to those fields. But, again, you do not seem to be doing that.
Another difference between Progress and your examples has to do with how data is displayed. Progress moves data back and forth from variables and fields to "the screen buffer" and the elements on the screen are not the same widgets and handles as the variables or fields. A SCREEN-VALUE is an attribute of a widget that is contained in a FRAME and the FRAME is contained in a WINDOW. These relationships are the "widget tree" that we are referring to (there is potentially a lot more complexity to it than that but the high level perspective is as I describe). The SCREEN-VALUE can be changed completely independently of any change to a variable that might be related to that widget. It is almost always a mistake to think of the SCREEN-VALUE as the value of the widget.
Your first post shows a tiny fragment of a screen with one column that looks like it might be from a (temp-)table displaying 12 records. Your Javascript/HTML code appears to be re-setting a value in a similar column.
Let's just assume that we are working with the sports2000 database and that we are going to show the discount% for the first 12 customers:
Code:
define variable i as integer no-undo.
form
customer.name customer.discount skip
with
frame a
12 down
.
for each customer no-lock:
display name discount with frame a.
down with frame a.
i = i + 1.
if i >= 12 then leave.
end.
So far, so good? We have 12 lines with 2 columns.
If I assume that you want to set all of those discounts to 0 for some reason then the code might look like this:
Code:
define variable ok as logical no-undo.
define variable i as integer no-undo.
form
customer.name customer.discount skip
with
frame a
12 down
.
/* review customer discounts
*/
do while true:
i = 0.
for each customer no-lock:
display name discount with frame a.
down with frame a.
i = i + 1.
if i >= 12 then leave.
end.
message "reset discounts?" view-as alert-box question buttons yes-no update ok.
if ok = yes then
do:
i = 0.
for each customer exclusive-lock:
discount = 0.
i = i + 1.
if i >= 12 then leave.
end.
next.
end.
leave.
end.
Notice how I changed the value of the field in the table and then re-displayed the data? That's much, much easier than walking the widget tree, finding the proper widget and then changing the SCREEN-VALUE, then somehow copying the SCREEN-VALUE back to the appropriate records from the database. (Simply changing the SCREEN-VALUE will have no impact on the data persisted in the database.) But that assumes that I have correctly guessed something similar to whatever it is that you are trying to accomplish and my confidence in that guess is low.