What happened?
Description
I am trying to use the orderBy clause on a custom date field for index page entries. The date fields are empty for some entries, and I would like those entries to be placed at the end.
The desired outcome can be achieved by using the fieldValueSql, but this requires an entryType. Is there an alternative method to accomplish the same without an entryType?
Current query:
{% do entries.orderBy('ISNULL('
~ fieldValueSql(entryType('notes'), 'datePublished')
~ '), datePublished ASC, title ASC') %}
Craft CMS version
5.5.9
PHP version
8.2.20
Database type and version
MySQL 8.0.36
What happened?
Description
I am trying to use the
orderByclause on a custom date field for index page entries. The date fields are empty for some entries, and I would like those entries to be placed at the end.The desired outcome can be achieved by using the
fieldValueSql, but this requires an entryType. Is there an alternative method to accomplish the same without an entryType?Current query:
Craft CMS version
5.5.9
PHP version
8.2.20
Database type and version
MySQL 8.0.36