10 Replies Latest reply: Aug 19, 2011 2:05 AM by Aadil M RSS

    defining variables

      hello,
      I'm new to QlikView ,I defined a variable in variable Overview and i tried to display it on the dashbaord using a straight table but it didn't return any values, on the contrary it 's returning  the  script itself
      example:
      variable's name is : " EE1"
      definition:
      If
      (date([Effective Date])> '30/05/2011' or date([Insured Date])> '30/05/2011',$(EE1) =0,
      if
      (date([Insured Date]) < '01/01/2011',
      if
      (date([Policy Expiry Date]) < '31/12/2010', $(EE1) =Round((date([Policy Expiry Date])-date([Insured Date]) +1 )/365,0.0001),
      if
      (date([Policy Expiry Date]) >= '31/12/2010', $(EE1) =Round((date('31/12/2010')-date([Insured Date]) +1 )/365,0.0001),
      if
      (date([Expiry Date]) < '01/01/2011',
      if
      (date([Policy Expiry Date]) < '31/12/2010', $(EE1) =Round((date([Policy Expiry Date])-date([Expiry Date]) +1 )/365,0.0001),
      if
      (date([Policy Expiry Date]) >= '31/12/2010', $(EE1) =Round((date('31/12/2010')-date([Expiry Date]) +1 )/365,0.0001),
      if
      (date([Insured Date])>= '01/01/2011', $(EE1) =0))))))))
      and
      if(date([Policy Expiry Date])> date([Expiry Date]),$(EE1) = $(EE1) * (-1))
      and when i want to display the values of this variable it returns the script itself..
      Please can anyone help me, thanks in advance.
        • defining variables
          Kaushik Solanki

          Hi,

           

              Add = at the beginning of the script in variable.

           

          Regards,

          Kaushik Solanki

          • defining variables
            Quentin Richard Bitegue-Bi-Essono

            Hi Christelle,

            First, Im not sure if it is necessary for you to use the $(EE1) expression in your variable definition. I woud think that it would be expected of you to use it when you call the variable in the front end.

              So, for instance, instead of writting

            EE1 = If(date([Effective Date])> '30/05/2011' or date([Insured Date])> '30/05/2011',$(EE1) =0,else....... , you may just write:

             

            EE1= If(date([Effective Date])> '30/05/2011' or date([Insured Date])> '30/05/2011', 0 ,else...

             

            Secondly, I want to know, are you sure your current qlikview date format is 'DD/MM/YYYY' ? and not 'YYYY/MM/DD' for example?


             

            • defining variables
              Rahul Gupta

              Try this:

              EE1=

              If

              (date([Effective Date])> '30/05/2011' or date([Insured Date])> '30/05/2011',0,

              if

              (date([Insured Date]) < '01/01/2011',

              if

              (date([Policy Expiry Date]) < '31/12/2010', Round((date([Policy Expiry Date])-date([Insured Date]) +1 )/365,0.0001),

              if

              (date([Policy Expiry Date]) >= '31/12/2010', Round((date('31/12/2010')-date([Insured Date]) +1 )/365,0.0001),

              if

              (date([Expiry Date]) < '01/01/2011',

              if

              (date([Policy Expiry Date]) < '31/12/2010', Round((date([Policy Expiry Date])-date([Expiry Date]) +1 )/365,0.0001),

              if

              (date([Policy Expiry Date]) >= '31/12/2010', Round((date('31/12/2010')-date([Expiry Date]) +1 )/365,0.0001),

              if

              (date([Insured Date])>= '01/01/2011', 0))))))))

               

              Now take another variable:

               

              EE2:

              =if(date([Policy Expiry Date])> date([Expiry Date]),$(EE1) = $(EE1) * (-1))