4 Replies Latest reply on Jun 5, 2012 10:56 AM by jake

    Conditional Field Result

    user17322

      Title

      Conditional Field Result

      Post

      I have a report that is a single line of output for each record. I want to include one of two fields conditioned upon the contents of a third.

       

      As an example:

       

      if Field 1 = Yes the report will look like this:

      Field 1 Field 2 Field 3 Field 4

      If Field A = No the report will look like this

      Field 1 Field 2 Field 3 Field 5

       

      There are both yes's and no's in the records for the report.

       

      Let me know if there is logic I can use to accomplish this.

       

      Thanks

        • 1. Re: NoFields
          philmodjunk

          Since you are using two fields that apparently store either yes or no, you have 4 possible combinations of values:

          Field1 = yes, Field A = no

          field 1 = yes, field A = yes

          field 1 = no, field A = no

          field 1 = no, field A = yes

          What would the report look like for each of these possible combinations?

          • 2. Re: NoFields
            jake

            Try using the case statement

            Case(test1;result1{;test2;result2;...;defaultResult})

            • 3. Re: NoFields
              user17322

              Jack,

              That looks like it will work. Where do I find that option? Not sure how to get that logic into the report. Pardon my lack of programming skill.

              • 4. Re: NoFields
                jake

                if you go to fm help it shows you a few examples, try this in a calculation field.

                 

                Case(field1 = "Yes";"yes"; field2 = "no";"no"; field2 = "yes";"yes";

                "If no statments are true - past your default here")

                 

                //keep using this formula field to query = "if result is";"answer"; 

                // make sure to have the calculation result as text