6 Replies Latest reply on Sep 26, 2018 6:56 AM by Gazz

    Expression syntax

    Gazz Apprentice

      Hi All,

       

      Having a bit of a hard time figuring out why this will not work.

       

      If the form is used in its basic layout with the requester being the person requiring the service all details populate into the task. However the form also has an option to select a box "Is this for another Person?". At this point the expression should sub that persons name instead of the requester and also populate the remainder of the forms details into the details section of the task but it only subs the person name and drop all the other details.

       

      I'm assuming I'm missing something in the expression that tells it to continue as normal ofter the ELSE.

       

      $(if GetSRPValue(RecId,  "RequestCheckbox") == true 

      then

      "Name:" + ToString(GetSRPValue(RecId,  "User")) 

      else

           "Name:" + ToString(GetSRPValue(RecId,  "Requester")) + "\n" +      

                "Mobile Number: " + ToString(GetSRPValue(RecId,  "UserMobile")) + "\n" +      

                     "Destination: " + ToString(GetSRPValue(RecId,  "UserDestination")) +  "\n" +

                          "Departure Date: " +       ToString(GetSRPValue(RecId,  "UserDepartDate")) + "\n" +

                               "Return Date: " +       ToString(GetSRPValue(RecId,  "UserRTNDate")) + "\n" +

                                    "Re-charge Code: " +       ToString(GetSRPValue(RecId,  "DeptRechargeCode")))

       

      Sample 1 - Working as expected

       

      Screen Shot 2018-09-26 at 11.14.10.png

       

      Sample 2 - Failing

       

      Screen Shot 2018-09-26 at 11.28.26.png

       

      Any help will be appreciated

       

      G

        • 1. Re: Expression syntax
          Juergen Voelkening Apprentice

          Hi Gazz,

          if i understand your question and you want to have the follwing result:

          Then you just have to change the parenthesis like this:

           

           

          $(if GetSRPValue(RecId,  "RequestCheckbox") == true

          then

          "Name:" + ToString(GetSRPValue(RecId,  "User"))

          else

               "Name:" + ToString(GetSRPValue(RecId,  "Requester")))

          + "\n" +     

                    "Mobile Number: " + ToString(GetSRPValue(RecId,  "UserMobile")) + "\n" +     

                         "Destination: " + ToString(GetSRPValue(RecId,  "UserDestination")) +  "\n" +

                              "Departure Date: " +       ToString(GetSRPValue(RecId,  "UserDepartDate")) + "\n" +

                                   "Return Date: " +       ToString(GetSRPValue(RecId,  "UserRTNDate")) + "\n" +

                                        "Re-charge Code: " +       ToString(GetSRPValue(RecId,  "DeptRechargeCode"))

          1 of 1 people found this helpful
          • 2. Re: Expression syntax
            Gazz Apprentice

            Hi Juergen

             

            I thought the same and I tried your suggestion but it still fails as it sees additional characters now.

             

             

            Screen Shot 2018-09-26 at 13.05.14.png

            • 3. Re: Expression syntax
              AlasdairRobertson ITSMMVPGroup

              Hi Gary

               

              Are you using a normal task block in your workflow or an extended task block, sometimes we find you need to use the extended task block to get the if statements to fire correctly.

               

              You expression looks and and parsed ok when I checked it.

              • 4. Re: Expression syntax
                Gazz Apprentice

                Hi Alasdair

                 

                Im using Extended.

                My one does not pass the info on onto the task when selecting the other person box even once the expression is saved.

                When I try saving with Juergen's format I get an error stating additional characters.

                 

                 

                 

                G

                • 5. Re: Expression syntax
                  lgtandi Specialist

                  There was an open parentheses missing at the beginning (before the "if") and a closing parentheses at the end, i.e. the following should give no syntax error:

                   

                  $((if GetSRPValue(RecId,  "RequestCheckbox") == true

                    then "Name:" + ToString(GetSRPValue(RecId,  "User"))

                    else "Name:" + ToString(GetSRPValue(RecId,  "Requester"))) +

                    "\n" + "Mobile Number: " + ToString(GetSRPValue(RecId,  "UserMobile")) +

                    "\n" + "Destination: " + ToString(GetSRPValue(RecId,  "UserDestination")) +

                    "\n" + "Departure Date: " + ToString(GetSRPValue(RecId,  "UserDepartDate")) +

                    "\n" + "Return Date: " + ToString(GetSRPValue(RecId,  "UserRTNDate")) + "\n" +

                    "Re-charge Code: " + ToString(GetSRPValue(RecId,  "DeptRechargeCode")))

                  1 of 1 people found this helpful
                  • 6. Re: Expression syntax
                    Gazz Apprentice

                    Excellent lgtandi. Thanks to all for the assistance, small things can cause hours of pain.