Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Sugy
Contributor
Contributor

Comparing 2 dates

I have 2 date fields which I need to compare:
I want to compare SNOWKEY_LENEL vs SNOWKEY_SNOW;
I only want to see the those which do not correspond but "Day_of_Visit" may not be older then the "Badged-date".


The field SNOWKEY_LENEL is a concatination of the numeric datefield "Badged_date" and a non unique number so this concatination makes it a unique field
The field SNOWKEY_NOW is a concatination of the numeric datefield "Day_of_Visit" and a non unique number so this concatination makes it a unique field

In my script I already had to make some format change on the "Day_of_Visit"
Date(Date#([Day of Visit],'mm-dd-yyyy'),'DD/MM/YYYY') as Day_of_Visit,

Labels (4)
1 Solution

Accepted Solutions
neerajthakur
Creator III
Creator III

Do not correspond to what ?

As far as I can understand you can do this in script

where Day_of_Visit < Badged_Date 

or you can create this flag, if(Day_of_Visit < Badged_Date,1,0) as Flag and use this flag in your expression in UI

This will give you all the records where Day_of_Visit is not more than Badged_Date.

Thanks & Regards,
Please Accepts as Solution if it solves your query.

View solution in original post

7 Replies
ogster1974
Partner - Master II
Partner - Master II

Your question seems incomplete...What are you looking to compare? the number of days between the 2 dates? i.e. "Badged_date"-"Day_of_Visit" as Num_Of_Days

Sugy
Contributor
Contributor
Author

Indeed my question was confusing and incomplete. I tried to be more clear now.

 

neerajthakur
Creator III
Creator III

Do not correspond to what ?

As far as I can understand you can do this in script

where Day_of_Visit < Badged_Date 

or you can create this flag, if(Day_of_Visit < Badged_Date,1,0) as Flag and use this flag in your expression in UI

This will give you all the records where Day_of_Visit is not more than Badged_Date.

Thanks & Regards,
Please Accepts as Solution if it solves your query.
Sugy
Contributor
Contributor
Author

My field Badged_date and SNOWKEY_LENEL come from 1 data connection qvd
My field Day_of_Visit and SNOWKEY_SNOW come from anoter data connection (excel)
In which load script do I put this Where or If clause?

Mathumitha
Partner - Contributor III
Partner - Contributor III

Hi @Sugy ,

 

In order to compare two date fields, you need to join the tables or concatenate the two tables based on your requirement. Once, the date fields come under the same table, you'll be able to compare them. 

Mathumitha
Partner - Contributor III
Partner - Contributor III

Also, make sure that both the date fields are in the same format

neerajthakur
Creator III
Creator III

You will need to join both these table on common key/ primary key and then make another table and load joined data as resident load there apply this logic.

Example:

NoConcatenate

Temp_Table:

Load ID,Day_of_Visit from Table1;

Left Join(Temp_Table)

Load ID,Badged_Date from Table2;

 

NoConcatenate

Final_Table:

Load *,

if(Day_of_Visit < Badged_Date,1,0) as Flag

Resident Temp_Table where Day_of_Visit < Badged_Date ;

 

Drop Table Temp_Table;

Thanks & Regards,
Please Accepts as Solution if it solves your query.