Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to create a filter in my Qlikview app for age. I am trying to create a multi box that allows us to select is a patient is 18 years or older, or younger then 18. I have a data field being pulled in from a sql statement Pat_Age. Any suggestions on how I can create those on screen filters would be appreciated.
May be something like this:
LOAD *,
If(Age(Now(), Pat_Age) >= 18, '18 years or older', 'Younger then 18') as FlagField;
SQL Select *
FROM Source....;
The easiest is to create an extra field in the script based on Pat_Age:
LOAD
...lots of fields,
Pat_Age,
If(Pat_Age>=18,'18 or older','Under 18') as Is18plus;
SQL SELECT ... FROM ... ;
Then use the new Is18Plus field in your multibox.
Altermatively you can also use the expression If(Pat_Age>=18,'18 or older','Under 18') in your multibox
Thanks Sunny for your assistance. Running into some issues. Here is what I have:
LOAD DOB,
"FULL_NM",
"PAT_KEY",
PAT_AGE,
"FlagField",
"PAT_MRN_ID";
SQL SELECT DOB,
extract (year from (age(current_date,dob))) as PAT_AGE,
If(Age(Now(), Pat_Age) >= 18, '18 years or older', 'Younger then 18') as "FlagField",
"FULL_NM",
"PAT_KEY",
"PAT_MRN_ID"
I don't know why the load of the data is failing.
Probably because your database server doesn't understand the Qlikview script syntax. Put the if statement in the preceding load like Sunny and I did in the examples we posted.
Something like this:
LOAD DOB,
"FULL_NM",
"PAT_KEY",
PAT_AGE,
"FlagField",
"PAT_MRN_ID",
If(Age(Now(), DOB) >= 18, '18 years or older', 'Younger then 18') as "FlagField";
SQL SELECT DOB,
extract (year from (age(current_date,dob))) as PAT_AGE,
"FULL_NM",
"PAT_KEY",
"PAT_MRN_ID"