Here is the code I have. I have tested it and it works on the one number field. (in Formcalc)
if ((FS270Pt1 >= 28.5) and (FS270Pt1 <= 38))
then FS270Pt1.font.fill.color.value = "0,0,0"
else FS270Pt1.font.fill.color.value = "255,0,0"
I have 15 number fields that I need to apply this color font to should the criteria be met. I am trying to use a While statement to achieve this. From what I know I have deduced that it would look something like this:
var i = 1
while (i <= 15)
if ((FS270Pt(i) >= 28.5) and (FS270Pt(i) <= 38))
then FS270Pt(i).font.color.value = "0,0,0"
else FS270Pt(i).font.color.value = "255,0,0"
i = i + 1
When I run the 'Check Script Syntax' I do not get any errors. However, at runtime it states that FS270Pt is unknown. How can I perform a loop on the binding names of the fields?
It will throw error. Because the instances of the field that you are referencing is not correct. You need to loop through the instances of the field. The field name is FS270Pt1. So it's instances witll be FS270Pt1, FS270Pt1, FS270Pt1 ..etc.
So inyour code replace
FS270Pt(i) with FS270Pt1[" + i + "]. It should work.