Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Declaring an expression in the load script - System Monitor

Hello all

I have developed a System Monitor as one of my projects and we are at a stage where my team needs to monitor the activity of the users.  We are looking at a 60 day flag, to tell us who hasnt accessed any application in 60 days or more.  I have some code below that is used as a calculated expression in a pivot table but I would want to declare this in the load script.

I want to do this so I can add it to a list box and choose what users have accessed an application after 60 days.  The flag works in the expression but, with it being on a pivot table I am not able to select all users, I can only select one for some reason.

Any help would be appreciated and my expression for my 60 day flag is below.

Thanks

=If(Left((Num(Today())),5)-Left(Num(Max([FK_Date])),5) >=60, 1,0)

9 Replies
tresesco
MVP
MVP

In the script, may be like:

Load

     If(Left((Num(Today())),5)-Left(Num(Max([FK_Date])),5) >=60, 1,0) as 60DayFlag

Anonymous
Not applicable
Author

Hi,

use the same expression. Load it in the resident table and use it as a field.

HTH

Ravi N.

Not applicable
Author

Sorry my code seemed to be a bit off, I have declared it without the equals sign and also used the alias to mark it as 60 day flag.

Not applicable
Author

I have set up the resident table in a new tab on the load script and it doesnt seem to be working.  I have edited the expression to see if it works by calling 'MakeDate'.

When I run this it tells me I have an invalid expression.

SixtyDayFlag:
LOAD

If(Left((Num(Today())),5)-Left(Num(Max(Session_Date)),5) >=60, 1,0) AS SixtyDayFlag,
If(MakeDate((Num(Today())),5)-MakeDate(Num(Max(Session_Date)),5) >=60, 1,0) AS SixtyDayFlagOne,
Session_Date

Resident Session
;

Anonymous
Not applicable
Author

Hi

Is this how you wanted it? This is working fine with me.

  Sample date::

New:

LOAD * Inline
[
FK_Date
1/2/2014
2/2/2014
]
;
load
If(Left((Num(Today())),5)-Left(Num(Max([FK_Date])),5) >=60, 1,0) as 60
Resident New;
drop Table New;

HTH,

Ravi N.

Not applicable
Author

This code seems to be loading the Sixty day flag in, however it is only giving me the option of '1' in the list box.  This means I can't choose between people greater or lower than 60days of access

Anonymous
Not applicable
Author

Hi,

I tried that but its not working out because the if statement cannot produce the name with the difference.

Not applicable
Author

Thanks for your help I will try some more at this expression.

Anonymous
Not applicable
Author

hmm.okay!