Expand my Community achievements bar.

SOLVED

Problem with If Statement

Avatar

Former Community Member

I have a table with 2 columns and 4 rows and am trying to set up an if statement that takes an X and converts it to a number and places it in a field on a different page.  I’ve tried putting a separate field into the table using a numeric field, a text field, or a check box and I cannot get the if statement to work.

If(“jobfield” = X) then 5 elseif (“jobfield2” = X) then 4 elseif (“jobfield3” = X) then 3 elseif (“jobfield4” = X) then 2 endif

Outstanding

Job field

Excellent

Jobfield2

Successful

Jobfield 3

Needs Improvement

Jobfield 4

The table with the If statement is like

Customer Service

If statement

Job Duties

If statement

Work Traits

Attendance

Total

This is the table with the If statements

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Could you post the form please?

Steve

View solution in original post

12 Replies

Avatar

Correct answer by
Former Community Member

Could you post the form please?

Steve

Avatar

Former Community Member

How do you attach a file?  I can't figure it out and even googled the question.

Avatar

Former Community Member

I cannot figure out how to post this, so I've attached it.

Thank you for your help.

Dusty Road

Avatar

Former Community Member

I found the annoucment that File Attachements is temporarily disabled.

Avatar

Former Community Member

I have not received the form.

Please send the form to stwalker.adobe@gmail.com

Avatar

Former Community Member

Problem 1  rawvalue should be rawValue

// form1.lastpage6.Nonexpanding6.Table3.Row1.Customerservice::calculate - (FormCalc, client)

//var CSout2

//if (form1.corefactorspage2.nonexpanding2.Table2.Row1.CSout2.rawvalue == 5) then 5 endif

$.rawValue = form1.corefactorspage2.nonexpanding2.Table2.Row1.CSout2.rawValue

Problem 2 Wrong event

// form1.lastpage6.Nonexpanding6.Table3.Row2.Jobduties::docClose - (FormCalc, client)

if("Jobout10" >= 4) then 5 endif

Problem 3 Not sure about syntax. Psuedo-code?

// form1.lastpage6.Nonexpanding6.Table3.Row2.Jobduties::calculate - (FormCalc, client)

//if("Jobout10" >= 4) then 5 endif

if (form1.attendancepage3.Nonexpanding3.Jobout10.rawValue >= 4) then 5 endif

Problem 4 As it stands you can pick all 5 of the check boxes in which case the  if-else logic is meaningless. You must either create a radio button exclusion group or add logic to un-check all check boxes but one.

// form1.lastpage6.Nonexpanding6.Table3.Row3.Worktraits::calculate - (FormCalc, client)

if("workout2")then 5 elseif("workexcel2")then 4 elseif("worksucc2")then 3 elseif("workneeds2")then 3 elseif("workunacc2")then 1 endif

Steve

Avatar

Former Community Member

First - thank you for all your help so far. My coworker and I are fumbling through the more advanced features of building a form.

Second - I think that I resolved the issue you reference in Problem 4 by using the radial button exclusion group you recommended.

Third - We can't get the IF statement to work. To that end, I was hoping to get some clarification on some of the items you mentioned below. Please keep in mind that I am not a programmer, so my questions are likely dumb.

In Problem 1, you referenced the below (I added the numbering for ease of reference):

1.// form1.lastpage6.Nonexpanding6.Table3.Row1.Customerservice::calculate - (FormCalc, client)

2.//var CSout2

3.//if (form1.corefactorspage2.nonexpanding2.Table2.Row1.CSout2.rawvalue == 5) then 5 endif

4.$.rawValue = form1.corefactorspage2.nonexpanding2.Table2.Row1.CSout2.rawValue

Questions...

1. This wording is not entered by the user, correct? It is already in the box where you enter the coding

2. This is user defined, right? I do have to enter this and I don't have to use "//" - I just have to type in "var CSout2"

3. At the end of the filepath for the variable CSout2, you tacked on "rawvalue" Do I actually use the + marks?

4. What does this statement do? And does it belong at the end of the IF statement? Or after the VAR statement?

Lastly, just to clarify - the above is using FormCalc and not Javascript, right? I want to make sure to have my settings right!

Tansy Diaz, HR Analyst and Laurie Herrman

City of Greeley

1000 10th Street

Greeley, CO 80631

P 970.350.9713

F 970.350.9707

tansy.diaz@greeleygov.com

It's free! Subscribe now so you won't miss the next edition of City Scoop, the City's monthly E-newsletter.

Avatar

Former Community Member

// indicates comments in the script editor. Meaning the code following in the same line as the // is not active.

I include the notation '// form1.lastpage6.Nonexpanding6.Table3.Row1.Customerservice::calculate - (FormCalc, client)' to highlight the event that the code is attached to.

You don't have to be concerned with either.

Take a look at the attached. I changed all the ratings to radio button exclusion groups, assigned the applicable value to the overall rating, and totaled the performance.

Let me know if there is anything else that needs to be straightened out.

Steve

P.S. Avoid using tables. They make forms really complicated and they bloat the size of a form. Just because you need to repeat a field does not mean you need a table. Tables are appropriate for repeating data in a spreadsheet use case.

Avatar

Former Community Member

Steve! You are a genius!!

Seeing how you named the radio button exclusion group, rather than the individual buttons and how you used the rawvalue statement was an eye opener – we were headed in a completely opposite direction. Your way was much simpler than a nested if then statement. I don’t know that we would have been able to reach our goal without your time and counsel. Thank you – thank you - thank you. It is very helpful to be able to see code that works and then be able to extrapolate base off that.

We did a happy dance though be glad you were spared from having to witness it!!

Tansy Diaz, HR Analyst and Laurie Herrman, Adm Specialist

City of Greeley

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----