4 Replies Latest reply: May 15, 2014 9:53 AM by vlad_ske _ RSS

    'If' Function

    vlad_ske _

      Hey,

      I need to find a way to combine two key fields into my 'condition' within my 'if' function

      for example if(salesman = 'salesman1'and 'salesman2',1,0)

      the part ('salesman1' and 'salesman2') does not work.

      I know there is way to go about this,

      I just do not have the experience on functions and aggregations.

        • 'If' Function
          Nigel Winton

          Hi there

          You have a couple of choices, using the And function it should look like if(salesman= sales man1.and. salesman = salesman2,1,0).

          Or you could use the In or NotIn functions to have

          If(salesman.in.("salesman1", "Salesman2"),1,0)

          Or alternatively you could use the NotIn to find those fields that do not have the required data.

           

          Have Fun

           

          Nigel

          • 'If' Function
            Bruce _

            Originally posted by vlad_ske:

            Hey,

            I need to find a way to combine two key fields into my 'condition' within my 'if' function

            for example if(salesman = 'salesman1'and 'salesman2',1,0)

            the part ('salesman1' and 'salesman2') does not work.

            I know there is way to go about this,

            I just do not have the experience on functions and aggregations. /b[/quote]Vlad

            Also you might need to use OR instead of AND. AND implies that both condiions are true at the same time. Also both conditions have to be spelled out in full, no shortcuts.

             

            Perhaps:

            if(salesman = 'salesman1' .OR. salesman = salesman2',1,0)

             

            Also see Nigel's suggestions about the .in. and .notin. they also would work fine.

             

            [size="1"][ June 06, 2007, 01:40 PM: Message edited by: Bruce ][/size]

            • 'If' Function
              Grant Perkins

              Nice suggestions above.

               

              A very basic alternative (or two) would be along the lines of;

              [font="courier"]if(salesman="salesman1",1,0)+if(salesman="salesman2",1,0)[/font][/quote]Or 'nest' them;

              [font="courier"]if(salesman="salesman1",1,

              if(salesman="salesman2",1,0))[/font][/quote]HTH.

               

               

              Grant

              • 'If' Function
                vlad_ske _

                Thanks Guys,

                I needed all of those perspectives, everything was relavent,

                 

                Cheers