Feature #79054
closedCustom Order By Clause
0%
Description
Hello,
in a Repository I will sort the result by a custom clause. For example I will search the nearest value. For this I calculate the deviation betwenn the values and rank them by this. So the first one will be the result with the nearest value.
For this i have to use prepared statements:
SOME SQL +order by ABS limit 1;
Would be nice if in the repository i could use something like:
$query->setOrderings(
array(
'ABS' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
)
);
Updated by Morton Jonuschat almost 8 years ago
- Status changed from New to Needs Feedback
Can you try if it works if you conform to the Extbase way of having fieldnames lowercased/underscored? Instead of `ABS` use `abs`.
Updated by Harald Holzmann almost 8 years ago
I have tried it: no changes. The typo3 error messages: "#1247602160: FUNCTION xxx.abs does not exist". He is looking for a column named xxx.abs, which obviously does not exist.
Updated by Alexander Opitz over 7 years ago
- Category set to Extbase
- Status changed from Needs Feedback to New
Updated by Dominik Steinborn over 7 years ago
The same error occurs when trying to order by the statement "IF": FUNCTION TABLENAME.i_f does not exist
$query->setOrderings(
array(
'IF(FIELD1='VALUE', FIELD2, FIELD3)' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
)
);
Updated by Dominik Steinborn over 7 years ago
- Priority changed from Should have to Must have
Updated by Benni Mack over 4 years ago
- Related to Feature #32051: Concat ordering for Database request added
Updated by Benni Mack over 4 years ago
- Status changed from New to Closed
Hey,
see issue #32051 which is already under review - I will close this one as a duplicate.