I have a bunch of News articles that I am listing down a page with a repeater. Some of the news articles have a DocumentPublishFrom date and others do not.
DocumentPublishFrom
I'd like to order the articles by DocumentPublishFrom, but if there isn't a DocumentPublishFrom, then I'd like to use DocumentCreatedWhen.
DocumentCreatedWhen
I am using the following code in the ORDER BY expression field (clicking on the black arrow) but it seem to not be working properly. Am I doing something wrong?
{% If (DocumentPublishFrom<DocumentCreatedWhen) { "DocumentCreatedWhen DESC" } else {"DocumentPublishFrom DESC"} #%}
COALESCE(DocumentPublishFrom ,DocumentCreatedWhen) DESC
I think I found the answer, at least it appear to be working now.
DocumentPublishFrom DESC, DocumentCreatedWhen DESC
I guess a macro wasn't needed.
Thanks Peter. Looks like my way didn't work, but yours worked perfectly. Thanks.
Please, sign in to be able to submit a new answer.