2 Replies Latest reply: Nov 5, 2015 4:44 AM by Alessandro Saccone RSS

    want to create conditional statement in where condition in script

    vir vir

      Hi,

       

      I am loading one table where i want to provide a condition that :

       

      (1)  IF User select Type = Booking   than booking filter should add with where condition

      (2) If user select Type = Arrival than arrival filter should Add with where condition

       

       

      Type is a field having 2 values ' Booking' and 'Arrival'

       

      variables are given below:

       

      vBooking =([Booking Year] >= $(vBookingFromYear) and [Booking Year] <= $(vBookingToYear));

      vArrival = Date([Arrival Date],'DD/MM/YYYY') >= Date(Addmonths(Today(),-4),'DD/MM/YYYY') and Date([Arrival Date],'DD/MM/YYYY') <= Date(Today(),'DD/MM/YYYY') ;

       

      Script is given below:

      booking_f:

      LOAD [Booking WID],

                  [Person WID]

            

      FROM

      $(vQvdFileLocation)booking_f.qvd

      (qvd)

      //WHERE([Booking Year] >= $(vBookingFromYear) and [Booking Year] <= $(vBookingToYear))

      //and Date([Arrival Date],'DD/MM/YYYY') >= Date(Addmonths(Today(),-4),'DD/MM/YYYY') and Date([Arrival Date],'DD/MM/YYYY') <= Date(Today(),'DD/MM/YYYY')   ;

      where

       

      Pick( Match ( Type, 'Booking', 'Arrival')

      ,'$(vBooking)','$(vArrival)');

       

       

       

      Please suggest ................the possible solution