Skip to main content
Announcements
Intermittent issues logging into the Qlik Community. We are working toward a resolution.
cancel
Showing results for 
Search instead for 
Did you mean: 
gustavofred
Contributor II
Contributor II

What is the best way to check if a variable is not null and a date?

see above

1 Solution

Accepted Solutions
QFabian
Specialist III
Specialist III

Hi @gustavofred ,  please check if this works for you :

In chart, in case of a variable :

=if(not isnull($(vDate)) and month($(vDate)) >=1 and month($(vDate)) <=12, 'date!')

or

=if(not isnull($(vDate)) and not isnull(month($(vDate)) ), 'date!')

In script, in case is a field :

Load

fields....

if(not isnull(fieldtoevaluate) and month(fieldtoevaluate) >=1 and month(fieldtoevaluate) <=12, 'date!')  as flagdate

From yoursource;

QFabian

View solution in original post

1 Reply
QFabian
Specialist III
Specialist III

Hi @gustavofred ,  please check if this works for you :

In chart, in case of a variable :

=if(not isnull($(vDate)) and month($(vDate)) >=1 and month($(vDate)) <=12, 'date!')

or

=if(not isnull($(vDate)) and not isnull(month($(vDate)) ), 'date!')

In script, in case is a field :

Load

fields....

if(not isnull(fieldtoevaluate) and month(fieldtoevaluate) >=1 and month(fieldtoevaluate) <=12, 'date!')  as flagdate

From yoursource;

QFabian