8 Replies Latest reply: Sep 9, 2014 6:52 AM by Shashank Vyas RSS

    Convert IF into SET analysis

    Shashank Vyas

      I have this code which is written with IF condition, Please help me with converting it into SET analysis

       

      =Count((IF(STATUS<>'Cancelled' Or STATUS<>'Expired' or STATUS<>'Pending Expiration',

      IF(REG_Flag>=1 or MED_Flag>=1 or LEG_Flag>=1 ,If(CalendarYear=$(vCurrentYear),object_name)))))

       

      Any leads will be helpful.

        • Re: Convert IF into SET analysis
          Martin Mahler

          Hi Shashank,


          This statement doesn't make sense to me as they cancel each other out. Are you sure it's not an AND statement?

          STATUS<>'Expired' or STATUS<>'Pending Expiration'

          • Re: Convert IF into SET analysis
            Manideep Hv

            Hi Shashank

            You wrote only true condition in the above mentioned IF statement. So my doubt is what if the above condition is false. But I understood that you are taking only true conditions to get some value. please try the below expression which I wrote from the above situation with little understanding. It could be better if you can elaborate more.

             

            Count({<STATUS-={'Cancelled','Expired', 'Pending Expiration'},

                          REG_Flag ={">=1"}, MED_Flag={">=1"}, LEG_Flag={">=1"},

                          CalendarYear={$(vCurrentYear)} >}object_name)

             

            Hope this helps.

             

            Regards,
            Manideep

            • Re: Convert IF into SET analysis
              Massimo Grossi

              count({$

                   <STATUS=-{'Cancelled','Expired','Pending Expiration'},REG_Flag={">1"}>*<CalendarYear={$(vCurrentYear)}>

                   +<STATUS=-{'Cancelled','Expired','Pending Expiration'},MED_Flag={">1"}>*<CalendarYear={$(vCurrentYear)}>

                   +<STATUS=-{'Cancelled','Expired','Pending Expiration'},LEG_Flag={">1"}>*<CalendarYear={$(vCurrentYear)}>

                   } object_name)

              • Re: Convert IF into SET analysis
                Pradip Sen

                Try this

                Count({<STATUS -={'Cancelled','Expired','Pending Expiration'}, CalendarYear={'$(vCurrentYear)'}, REG_Flag -={1}>} object_name)

                +

                Count({<STATUS -={'Cancelled','Expired','Pending Expiration'}, CalendarYear={'$(vCurrentYear)'}, MED_Flag -={1}>} object_name)

                +

                Count({<STATUS -={'Cancelled','Expired','Pending Expiration'}, CalendarYear={'$(vCurrentYear)'}, LEG_Flag -={1}>} object_name)