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"
endif
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)
do
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"
endif
i = i + 1
endwhile
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?
Solved! Go to Solution.
Views
Replies
Total Likes
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[0], FS270Pt1[1], FS270Pt1[2] ..etc.
So inyour code replace
FS270Pt(i) with FS270Pt1[" + i + "]. It should work.Thanks,
Bibhu.
Views
Replies
Total Likes
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[0], FS270Pt1[1], FS270Pt1[2] ..etc.
So inyour code replace
FS270Pt(i) with FS270Pt1[" + i + "]. It should work.Thanks,
Bibhu.
Views
Replies
Total Likes
Bibhu,
Thank you very much. That worked out perfectly for me. It really sucked though that I had to go back and change all my number field binding names though. Oh well. The only thing I did different was I used:
FS270[i] instead of FS270["+i+"]
It works and looks a little cleaner I think.
Thanks again,
Dennis
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies