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

Expression in Script not working properly.

Hi,

i have below expression, i need to put in variable in script loader.

count({$<Names_of_day={'Mon'},MonthPeriod_Runrate={'$(=month(weekend(Max(CanonicalDate)))& year(weekend(Max(CanonicalDate))))'},

    Date_Runrate={">=$(=Date(Min(Date_RunRate)))<$(=Date(Today()))"}>}Names_of_day)

I tried

Let vNum_Mondays_Passed = 'count({$<Names_of_day={''Mon''},MonthPeriod_Runrate={"<$' &'(=month(weekend(Max(CanonicalDate)))& year(weekend(Max(CanonicalDate))))"},

    Date_Runrate={">=$' &'(=Date(Min(Date_RunRate)))<$' &'(=Date(Today()))"}>}Names_of_day)';

But not working properly, it gives me Zero count.  How to do this????

1 Solution

Accepted Solutions
berryandcherry6
Creator II
Creator II
Author

Thanks Sunny.

My expression should be like this, with variable overview i was able to check syntax of my Expression.

Let vNum_Mondays_Passed = 'count({$<Names_of_day={''Mon''},MonthPeriod_Runrate={"$' &'(=month(weekend(Max(CanonicalDate)))& year(weekend(Max(CanonicalDate))))"},

    Date_Runrate={">=$' &'(=Date(Min(Date_RunRate)))<$' &'(=Date(Today()))"}>}Names_of_day)';

I was using extra angle brackets after dollar sign of  MonthPeriod_Runrate. So i was not able to get count

View solution in original post

8 Replies
sunny_talwar

Have you checked the variable overview to see if after reloading the script, the variable definition gives you the exact match as your original expression?

Not applicable

Try this,

set vNum_Mondays_Passed = count({$<Names_of_day={"Mon"},MonthPeriod_Runrate={'$(=month(weekend(Max(CanonicalDate)))& year(weekend(Max(CanonicalDate))))'},

    Date_Runrate={'>=$(=Date(Min(Date_RunRate)))<$(=Date(Today()))'}>}Names_of_day)

-abdul

berryandcherry6
Creator II
Creator II
Author

Hi,

Thanks for reply

sorry, i didnt get you.

How to check variable overview?

sunny_talwar

This thing

Capture.PNG

Anonymous
Not applicable

Hi Supriya,

To check the variable overview you need to go to settings and look for Variable Overview (Ctrl+Alt+V) is short cut. Also Sunny wants you evaluate your variables before you try them in set analysis expression.

To check you variable, you can test in Text box writing that variable and see what is the result. go one by one you may get the error prone area.

ramasaisaksoft

Hi Supriya,

may be this is the format issue ,just check (MonthPeriod_Runrate,Date_Runrate,CanonicalDate)

berryandcherry6
Creator II
Creator II
Author

Thanks Sunny.

My expression should be like this, with variable overview i was able to check syntax of my Expression.

Let vNum_Mondays_Passed = 'count({$<Names_of_day={''Mon''},MonthPeriod_Runrate={"$' &'(=month(weekend(Max(CanonicalDate)))& year(weekend(Max(CanonicalDate))))"},

    Date_Runrate={">=$' &'(=Date(Min(Date_RunRate)))<$' &'(=Date(Today()))"}>}Names_of_day)';

I was using extra angle brackets after dollar sign of  MonthPeriod_Runrate. So i was not able to get count

sunny_talwar

I am glad you were able to figure it out