Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

boorgura
Valued Contributor

Problem with condition in expression.

Hi guys,

I came across, something which looks a wierd behavior to me.

I have a chart, where in, the expression should have a condition.

So i have a variable created (in the variable overivew) which evaluates the recent most Friday.

its calculated as '=weekend(today(),-1,-2)'. which works fine when tested.

But in the expression, if i place the condition as if(theDate = RecentFriday,'then do this'), it doesn't work.

instead if I do if(theDate = '2/19/2010','then do this'). it works fine.

and i checked the value of the RecentFriday.... it shows 2/19/2010.

Any help would be greatly appreciated.

Thanks,

Rocky

1 Solution

Accepted Solutions
Not applicable

Problem with condition in expression.

Hi

Have you tried using variable expansion, like this:

if(theDate = '$(RecentFriday)','then do this')

regards
/Fredrik

4 Replies
vgutkovsky
Honored Contributor II

Problem with condition in expression.

Rocky,

Sometimes the problem in these cases is just date formatting. Try this as the condition: if(num(theDate) = num(RecentFriday)) and see if it works. I've also seen where the date format is actually DD/MM/YYYY even though the date shows as M/DD/YYYY. So try the above condition, and if it doesn't work try some different date-formatting combinations.

Regards,

Not applicable

Problem with condition in expression.

Hi

Have you tried using variable expansion, like this:

if(theDate = '$(RecentFriday)','then do this')

regards
/Fredrik

Not applicable

Problem with condition in expression.

for me it a problem of date mismatch types.

Try to Transform =weekend(today(),-1,-2) in =date(weekend(today(),-1,-2),'MM/DD/YYYY')

Hope this help

Bud

boorgura
Valued Contributor

Problem with condition in expression.

Thanks a lott guys...

Frederik.. you got it man.

I did try $(RecentFriday)... but did not try '$(RecentFriday)'... which worked... (just to emphasize... the quotes were missing)

Thanks all once again..

-Rocky

Community Browser