2 Replies Latest reply on Aug 3, 2017 8:30 AM by AnthonyDowns

    IF/Case statements failing

    Gazz Apprentice

      Hi All,

       

      Would appreciate it if anyone could tell me why this is not working. HELP Please!!!!

       

      I have tried both If and Case statements but in both the cases everything from the highlighted in green down does not work. Ideally this should display an additional box with toner colours if they select "Toner" in addition if they select toner while selecting "Other" as the model the toner colour box does not display until they have add text to the free text box which would represent the make/model of the printer.

       

      Image 1 shows it working correctly as its the first section of the statement

       

       

      Image 1

       

      Image 2 fails when the user selects Printer Type as "Other" and inputted HPxxx as the printer make (OtherPrinter)..... This si the same if the user selects Printer type as HP LaserJet (Predefined selection), this whoud immediately display the toner colour box but fails.

       

      Image 2

       

       

       

       

      IF Statement

       

      if RequiredService == "Toner Collection Unit" &&

           PrinterType == "MFD/Photocopier" && PrinterType == "HP LaserJet" &&

           PrinterType == "Other"

        then false

        else if RequiredService == "Toner" && PrinterType == "MFD/Photocopier" ||

                PrinterType == "HP LaserJet"

             then true

             else if PrinterType == "Other" && OtherPrinter != ""

                  then true

                  else false

       

      Case Statement

       

      case

        when RequiredService == "Toner Collection Unit" &&

             PrinterType == "MFD/Photocopier"

             then false

        when PrinterType == "HP LaserJet" then false

        when PrinterType == "Other" then false

        when RequiredService == "Toner" && PrinterType == "MFD/Photocopier" ||

             PrinterType == "HP LaserJet"

             then true

        when PrinterType == "Other" && OtherPrinter != "" then true

        else false

       

       

      Thank

       

      G

        • 1. Re: IF/Case statements failing
          Gazz Apprentice

          Ok those we ramblings of a mad man as I posted the wrong statements and then on inspection I realised what I had done wrong. Here's the reworked statement...

           

           

          if RequiredService == "Toner Collection Unit"

            then false

            else if RequiredService == "Toner" && PrinterType == "MFD/Photocopier" ||

                    PrinterType == "HP LaserJet"

                 then true

                 else if PrinterType == "Other" && OtherPrinter != ""

                      then true

                      else false

          • 2. Re: IF/Case statements failing
            AnthonyDowns Specialist

            I can't test this at the moment but it seems like a similar issue I was having before. When testing for null it fixed my issue.

             

            if RequiredService == "Toner Collection Unit"

              then false

              else if RequiredService == "Toner" && PrinterType == "MFD/Photocopier" ||

                      PrinterType == "HP LaserJet"

                  then true

                  else if PrinterType == "Other" && nvl(OtherPrinter, "") != ""

                        then true

                        else false

            1 of 1 people found this helpful