0

I am trying to check what records in a data extension are from today.

The data that is in the date field, 'localtime', looks like this:

Thursday, November 01, 2018 10:07 PM

Friday, November 02, 2018 09:00 AM

I try to find if a record, based on mobile phone, already exist in a data extension for today:

var @today, @checkExist, @existsAlready
set @today = FormatDate(now(1),"YYYY-MM-DD")
set @checkExist = 
LookupRows(@MYDataExtension,'mobile',@Mobile,'localtime',@today)

IF (RowCount(@checkExist) >= 1) THEN
set @existsAlready = 'true'
else then set @existsAlready = 'false'
endif

It just gives me "false" even if there are records from today, Ideas?

2

In case someone else is looking for a solution, I solved it using "Datediff". So, looping through all records and comparing todays date with the date of the record. If the difference between the dates is less than 1 day, then it is a record from today.

set @diff = DateDiff(@date_on_record,@Today1, 'D')

 if @diff < 1 then
 set @less_than_1_day = 'true'
 else then set @less_than_1_day = 'false'
 endif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.