6 Replies Latest reply on Aug 28, 2013 7:27 PM by PLT1128

    Very Simple if/then problem, but cannot figure it out.

    PLT1128

      I have two simple Text fields, i.e. Rating and Possible.  They are formatted as numbers.  All I want to do is the following: 

       

      If Rating = zero, then Possible will also be zero.  However, if Rating is any number > zero, then Possible will always be 3.

       

      I have tried more options and have had no success.

        • 1. Re: Very Simple if/then problem, but cannot figure it out.
          George_Johnson MVP & Adobe Community Professional

          What should Possible be if Rating is less than zero?

          • 2. Re: Very Simple if/then problem, but cannot figure it out.
            PLT1128 Level 1

            It will never be less than zero.  However, if it was, then Possible would still be 3. It would probably be best to plan on a negative rating and use a not equal to zero condition will be 3.  Guess, basically, anything, but a zero Rating will always be a 3 and a zero Rating will be a zero. 

            • 3. Re: Very Simple if/then problem, but cannot figure it out.
              George_Johnson MVP & Adobe Community Professional

              OK, the custom calculation script for the Possible field could be something like:

               

              // Custom Calculate script

              (function () {

               

                  // Get the Rating field value, as a number

                  var v = +getField("Rating").value;

               

                  // Set this field value

                  event.value = v === 0 ? 0 : 3

               

              })();

               

               

              That last line is equivalent to:

               

              if (v === 0) {

                  event.value = 0;

              } else {

                  event.value = 3;

              }

               

               

              If rating is blank, converting to a number will give 0, so Possible will get set to 0.

              • 4. Re: Very Simple if/then problem, but cannot figure it out.
                PLT1128 Level 1

                Thank you so much.  Can I ask two more questions.

                 

                1.  I have noticed on most of the posts that there is a lot of line spaces between various lines.  When I input the script should I paste exactly as is (spaces and all) or pull everything into one long text or start each new line as a separate line without spaces.

                 

                2.  One of your lines says "That last line is equivalent to:". Was that line instruction for me or should I include. 

                 

                I so MUCH VALUE this help.

                • 5. Re: Very Simple if/then problem, but cannot figure it out.
                  George_Johnson MVP & Adobe Community Professional

                  You don't need more than one blank space between lines of code.

                   

                  No, you should not include that comment I added. It was just a note to you that the one line of above was equivalent to the five lines of code that followed.

                  • 6. Re: Very Simple if/then problem, but cannot figure it out.
                    PLT1128 Level 1

                    George,

                    Again, my thanks.  Unfortunately, my next step did not work.  Let me explain my original goal.  We have a Portfolio form where we rate student submissions using various standards.  For example, Standard I has 5 submission areas, Standard II has 9 subareas, etc.  The submissions are turned in over 3 to 4 semesters.  Each submission is worth up to 3 points.  The problem is that in one semester, a student may only turn in 3 of the 5 subareas for Standard I.  So, a professor will use a Rating for each subarea.  If I was a student I could earn 3 pts out of 3 for the 1st subarea (Sub1), 2 out of 3 for the 2nd subarea (Sub2) , and 3 out of 3 for the 3rd area (Su3). So far, I have earned 8 out of 9 possible points (Poss). 

                     

                    We want to translate all points for this standard so students will be given a rubric ranging from 0 to 3.  To translate my score of 8, we use a formula of (8/9)*3 or

                     

                    Standard 1 = (Sub1+Sub2+Sub3)/(Poss1+Poss2+Poss3)*3. 

                     

                    Actually, since there 5 ratings in Standard1, the real formula is:

                     

                    Standard 1 = (Sub1+Sub2+Sub3+Sub4+Sub5)/(Poss1+Poss2+Poss3+Poss4+Poss5)*3.

                     

                    This formual works, but it would require the rater to have to provide a rating and then put in the possible score each time.  We cannot put in 3's for each of the Poss areas, as having 3's in each Poss would mess up the conversion.  As an example, the Poss for my score is 9, but if all Poss scores were entered, the Poss score would be 15 (as there are 5 ratings).

                     

                    With your formula/scripts, we do not have to do this.  Unfortunately, when I try to enter my formula into the "Simplified Field Notation" or "Custom Calculation Script" it will sometimes work.  However, as I try to enter a rating, I will get a message which basically says "The value entered does not match the format of the field for [Standard I]" -

                     

                    I have also tried to add an extra field below my custom script and told it to add all of the scores resulting from the custom calculations.  This earns the same error message.  I then tried adding text fields next to each custom script and made it equal to the value of the custom script..again, no help.

                     

                    Basically, I suspect there is some mechanism that would provide a count of the number of items rated.  Such as if I put in 3 ratings in a standard, it would give me the value of 3.  However, I wonder if that would result in the same type of problem. 

                     

                    Overall I suspect that my problem is that the formulas I want to use to "get me my possible points" are not able to use the custom data in a formula that is standard. 

                     

                    Hope some of this makes sense.  I could email you the form - as am not sure how clear the image is (see below).

                     

                    Thanks...we have tried every possible mechanism/strategy we could think of with no luck.  At one point, I thought I had it working for the first standard, but then when I went to next level, it fell apart...

                     

                     

                    Portfolio Submissions for LiveText 08.28.13_Page_1.jpg