Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
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
MVP
MVP

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;

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.

View solution in original post

1 Reply
QFabian
MVP
MVP

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;

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.