12 Replies Latest reply on Apr 15, 2010 7:42 AM by Dusty Road

    Problem with If Statement

    Dusty Road

      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. Re: Problem with If Statement
          Steve L Walker Level 5

          Could you post the form please?

           

          Steve

          • 2. Re: Problem with If Statement
            Dusty Road Level 1

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

            • 3. Re: Problem with If Statement
              Dusty Road Level 1

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

               

              Thank you for your help.

               

              Dusty Road

              • 4. Re: Problem with If Statement
                Dusty Road Level 1

                I found the annoucment that File Attachements is temporarily disabled.

                • 5. Re: Problem with If Statement
                  Steve L Walker Level 5

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

                   

                  Steve

                  1 person found this helpful
                  • 7. Re: Problem with If Statement
                    Dusty Road Level 1

                    This is not answered

                    • 8. Re: Problem with If Statement
                      Steve L Walker Level 5

                      I have not received the form.

                       

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

                      • 9. Re: Problem with If Statement
                        Steve L Walker Level 5

                        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
                        • 10. Re: Problem with If Statement
                          Dusty Road Level 1

                          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.

                          • 11. Re: Problem with If Statement
                            Steve L Walker Level 5

                            // 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.

                            1 person found this helpful
                            • 12. Re: Problem with If Statement
                              Dusty Road Level 1

                              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