Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.
10 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Add = at the beginning of the script in variable.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

hello Kaushik,

Thank you so much for your answer, yet I tried to apply your advice and here's the following :

the expression of the variable didn't show anymore which is good but still no values,did i miss something in the script ?

Thanking you so much in advance.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    I would say instead of using date in this way. i.e '30/05/2011' use

    makedate(2011,05,30)

    Change at every location, with respective date in makedate.

  

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

well Kaushik ,

i try it but i'm getting the same result, no values are show .

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Is it possible to upload the qvw file.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

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?


rahulgupta
Partner - Creator III
Partner - Creator III

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))

Not applicable
Author

hello  ,

my current qlikview date format is 'DD/MM/YYYY'  and i also tried your method by removing the $(EE1)=....  but it didn't work.

Not applicable
Author

Please,

would it be possible for you to send us a QVW sample file?

Regards.