I wasn't able to find out or figure out but the page here http://help.exacttarget.com/en/documentation/exacttarget/content/ampscript/ampscript_syntax_guide/data_extension_ampscript_functions/#LookupOrderedRows suggests that we can create an AND clause within lookupOrderedRows. (Be awesome to create filters like that on the fly!) I don't see any directions on how. What we wish to do is filter the results first by a matched GUID code and then by a datestamp.

Set @rows2 = LookupOrderedRows("Cars",4,"Horsepower Desc","MPG",Field(@cardata,"MPG"), StartDate > NOW())

Does this need the word AND within the script or something else to make sense of the formula?

  • So it appears the script was ok, but adding parameters with comparison operators other than "=" will require a Filter so this won't do what I'd hoped in this instance. Still useful in many other ways as indicated in answers below. – Jonny Shaw May 28 '14 at 19:03

To build an AND clause, you just keep adding parameters. Note you can only do a look up against EQUALS, not greater than like in your example. If you need to do that, you should use ExecuteFilter with a DataFilter

So, it would be something like:

LookupOrderedRows("Cars",4, "name1", @val1,"name2", @val2,"name3", @val3)
| improve this answer | |

The values are only compared with =.

Set @rows2 = LookupOrderedRows("Cars",4,"Horsepower Desc","MPG",Field(@cardata,"MPG"), StartDate, NOW())

This would only return those whos StartDate are equal to Now().

| improve 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.