Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

Check if date exists in table - script

Hi All,

i am trying to put an if statement in my script to say that if date(today())  is included in a list of dates then run the script otherwise exit script.

so i have a list of dates that i would first need to load in, i'm guessing as a variable, i then want to compare todays date with that variable. if a match is found then carry on with script, else exit.

I am unsure on how to do this, i cam do it in the front end but obviously thats no good, i cant seem to convert it to scripting.

can anyone help please?

1 Solution

Accepted Solutions
andrei_delta
Partner - Creator III
Partner - Creator III

Hello,

This is an example:

TableA:

Load

...,

DateField

From/Resident X;

let vRows=NoOfRows('TableA');

let vToday=date(Today(),'your format');

let vScriptExit='Exit script;';

for i=0 to $(vRows)-1

let vDateFromList= chr(39)&peek('DateField',i,'TableA')&chr(39);

if wildmatch(vToday, $(vDateFromList)) then

$(vScriptExit);

endif

next i;

Hope it helps,

Andrei

View solution in original post

1 Reply
andrei_delta
Partner - Creator III
Partner - Creator III

Hello,

This is an example:

TableA:

Load

...,

DateField

From/Resident X;

let vRows=NoOfRows('TableA');

let vToday=date(Today(),'your format');

let vScriptExit='Exit script;';

for i=0 to $(vRows)-1

let vDateFromList= chr(39)&peek('DateField',i,'TableA')&chr(39);

if wildmatch(vToday, $(vDateFromList)) then

$(vScriptExit);

endif

next i;

Hope it helps,

Andrei