According to the documentation I'd expect that I could further refine results within the AMPscript ExecuteFilterOrderedRows() function.

What we want our pages to do is to display the results within a filter and then use a RequestParameter() function to limit those results to those with a matching ID field. I already know the parameter is being captured on the page as it's used to gather additional info (like a product name) and appears correctly within the title tag and an H1 on the page itself.

ExecuteFilterOrderedRows("FILTER-stuff", 0,"Date", "prodID", @PL)

My expectation is that the filter would return a rowset parsed from FILTER-stuff, ALL rows, ordered by date, where the "prodID" matches the @PL requested parameter.

The filter itself looks at all items in the data extension and simply filters for Date > today. It also looks at "prodID" field from the extension to simply verify that prodID > 0 (since prodID is a number field all should be > 0) is "null" > 0? and even if it was I expected the AMPscript to return only results where "prodID" == @PL (always a #).

  • Please post the content of your data filter, so we can have a look.
    – Timothy
    May 30, 2014 at 17:50
  • data extension values match ("prodID" != 0) AND ("Active" == "Active" OR "Active" == "Preview") AND ("StartDate" == today's date OR "StartDate" > today's date) so I'm thinking it should return the full set THEN a query ought to be able to parse through that for the records where "prodID" matches an @PL code supplied in the URL.
    – Jonny Shaw
    May 30, 2014 at 18:19

1 Answer 1


Any sorting bordering on complex ought to be done in a Query Activity, with the results stored in order in a DE. Then, just get the results, and you can rely on them being in order and segmented correctly.

  • Not sure I understand but let me try. So a query is not like lookuporderedrows but a separate thing (a function?). And in creating my query I can then post the results into a new temporary DE and use AMPscript to list the results held in that DE? Am I close?
    – Jonny Shaw
    May 30, 2014 at 18:13
  • Correct. You need to do that within the app itself (log in to mc.exacttarget.com). I would do it like so: 1. Write a SQL query in a query activity to do my segmenting. 2. Use AMPscript to execute it (see help.exacttarget.com/en-US/documentation/exacttarget/content/… and help.exacttarget.com/fr-FR/technical_library/web_service_guide/… for how to do that)
    – Timothy
    May 30, 2014 at 18:30
  • help.exacttarget.com/en/documentation/exacttarget/content/… Found this page as well (from your links) which sounds (create complex filter via ampscript) like what I need. All new stuff to me. Looking now for any tutorials or prerequisites that would help this make more sense.
    – Jonny Shaw
    May 30, 2014 at 19:12
  • That works too. For large data sets, the query activity is still your best bet.
    – Timothy
    May 30, 2014 at 20:15
  • It's all giving that "where do I begin?" feeling. I'm good with AMPscript and DE usage. I suppose I should begin experimenting with the code above and see what it does. Any "suggestions for noobs" in this realm will be considered. Appears that much of this is still beyond my sphere of familiarity. Thanks so much for your help Timothy.
    – Jonny Shaw
    May 30, 2014 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .