Copy link to clipboard
Copied
I have looked for an answer to this problem for a few weeks and seem to find part of the answer, but haven't been able to put it all together.
I am using:
I am creating a fillable form where individuals will fill in the % for their metric into the Results field and that field will check the Targets fields to determine which stamp will show in the Score field. For example, the Target is >89% so, if 95% is entered into the Results field, the Green stamp should show in the Score field, if 85% is entered in the Results field, the Yellow stamp should show in the Score field, etc.
I have 6 different teams and each team has 1-6 metrics to report out on.
Target fields (currently named - "team.color.field iteration") -
Results field (currently named - "team.results.field iteration") -
Stamps (named Green, Yellow, Red) -
Copy link to clipboard
Copied
Instead of stamps use image fields with those icons already pre-selected as the field's icon. It will be much easier to show the correct field (and hide the others), than to use stamps for this.
Copy link to clipboard
Copied
So, would I have 3 image fields on top of each other? There is only one score field and 3 images. I have a total of 30 rows that have a results field & score field. Each of those results fields will be validated against a different set of target fields. I originally started with an image field, but couldn't find the right script to show or hide the needed image based on what is entered in the results field. Basically, I need the script to take what is entered in the results field (on page 2 of the document), compare it to the target fields (on page 27 of the document) to determine which image should show in the score field (on page 2 of the document).
I'm quite sure I am over thinking it and it is much simpler than I am trying to do.
Copy link to clipboard
Copied
Either that, or use (hidden) image fields with the images you want to use, and then copy them over to a single field for each result, yes. That approach requires a bit more complicated script, but will cut the number of fields you need to create by 66% (1 instead of 3 for each outcome). If you chose the latter option you would also need to create a (single) "blank" image field, for when you don't want to display anything.
Copy link to clipboard
Copied
As for the code, here's the basic code to show/hide the fields in your original screenshot (to be used as the custom Validation or Calculation script of the results field):
this.getField("IMP.red.1").display = (event.value<80) ? display.visible : display.hidden;
this.getField("IMP.yellow.1").display = (event.value>80 && event.value<=89) ? display.visible : display.hidden;
this.getField("IMP.green.1").display = (event.value>89) ? display.visible : display.hidden;