I would like to use date LookupOrderedRows()

My code:

SET @DetailRows = LookupOrderedRows("ST_Import_date", 1, "ID ASC", "Import_Date", Format(now(),"MM/dd/yyyy"))

When I try to get the rows with respect to current date, I am not getting matching rows(row count is 0). but the DE does contains today's date.

Could you please help me if I miss anything?


Dates in SFMC are stored with the time (e.g. datetime). In order to retrieve a row, you'll need to know the time portion also. All of the AMPScript lookup functions require an exact match.

Another option is to use API filter with AMPScript. It's a little more involved, but it allows you to use more operators.

AMPScript InvokeRetrieve

You'd want to use the DataExtensionObject[DECustomerKey] Object to pull from a Data Extension. Partial example can be found in this answer.

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.