Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Help with Form Calc

Avatar

Level 1

I have a performance evaluation where I am trying to calculate the total number of "exceeds ratings". I am using the following script and it works for a single field. I am now trying to calculate the total number of exceeds for multiple fields.  this.rawValue is my calculating field.  FieldName is the field the rating is entered. if the number entered is < 36 there should be no +1. So in other words, if I have 4 ratings entered that are > 36 my calculating field should say 4.  This may be simple for most but I do not do this to often. Please help. Thank you!

         if (FieldName > 36) then

this.rawValue = + 1

         endif



Amy

7 Replies

Avatar

Level 7

Are your other fields part of a table? If not, you may have to call each of them individually. Something like:


var t = 0


if (field1 > 36) then t=t+1 endif


if (field2 > 36) then t=t+1 endif


if (field3 > 36) then t=t+1 endif


if (field4 > 36) then t=t+1 endif


t


Avatar

Level 1

This is my table...see the third line up from the bottom...there are three small boxes, each box should represents Exceeding, or Achieving or Below. Each box should add the Mid Year Results from above. So in other words, if there are 5 scores entered above that are > 97, then the number 5 should be entered in the small box below.

781151_pastedImage_0.png

Avatar

Level 7

Since each row has different information, I'll presume they are also named differently. Something like taxCollectorCustomerSatisfaction.tfMid and telephoneSurvey.tfMid for the first two rows. Whatever you called them, just make sure you're using the row name and cell name in your script.


var t=0


if (taxCollectorCustomerSatifaction.tfMid > 36) then t=t+1 endif


if (telephoneSurvey.tfMid > 36) then t=t+1 endif


//more lines for the rest of the table


t


Avatar

Level 1

Thank you for trying to help...it still will not calculate and quite possibly because I am not doing something right. I tried selecting FormCalc and got an error. I didn't get an error with JavaScript but it would not calculate.

var t=0

if (CustSatisfaction1.tfMid > 97) then t=+1 endif

if (TelephoneSurvey1d.tfMid > 97) then t=+1 endif

t

Avatar

Level 7

FormCalc doesn't recognize the =+ operator. You'll have to write it out. FormCalc will treat it as t = "+1" and output that at the end.

Avatar

Level 1

Thank you, please forgive me for sounding ignorant, but this is only the second form I've built using FormCalc and LiveCycle.

How exactly would I need to write it out. That is the part I don't know.