Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Attempting to create an active flag

Hi, I just started using Qlik Sense and I'm trying to create an active flag filter that can mark a post as either active or inactive depending on what dates it's is set to activate between.
I've attempted to do this by importing an excel file that contains todays date and I'm pulling the activation/deactivation dates from a database. I'm not very familiar with how the code in Qlik Sense works so I tried some VERY basic solutions to my problem, the main one being:

if (TodaysDate > VALIDFROM and TodaysDate < VALIDTO, FlagActive = 1)

I'm attempting to do this so that I can show only  active or inactive users.

Apologies for somewhat poor english, it isn't my main language.

Thank you in advance

1 Solution

Accepted Solutions

Re: Attempting to create an active flag

You can create such a field in the data load script:


MyTable:

LOAD

     ...some fields...,

     if( VALIDFROM < today() AND VALIDTO > today(), 1, 0) as FlagActive,

     ...some more fields...

FROM ...mysource


Note that the VALIDFROM and VALIDTO fields need to be real  date fields. If those fields contain text values you'll have to use the date# function to turn the text values into strings. For example date#('31/12/2014', 'DD/MM/YYYY') will turn the string 31/12/2014 into a real date value.


talk is cheap, supply exceeds demand
2 Replies

Re: Attempting to create an active flag

You can create such a field in the data load script:


MyTable:

LOAD

     ...some fields...,

     if( VALIDFROM < today() AND VALIDTO > today(), 1, 0) as FlagActive,

     ...some more fields...

FROM ...mysource


Note that the VALIDFROM and VALIDTO fields need to be real  date fields. If those fields contain text values you'll have to use the date# function to turn the text values into strings. For example date#('31/12/2014', 'DD/MM/YYYY') will turn the string 31/12/2014 into a real date value.


talk is cheap, supply exceeds demand
Not applicable

Re: Attempting to create an active flag

Thank you for the help, was completely stumped on what to do

Community Browser