Using parameters in a sort expression

Created on 1 July 2022, over 2 years ago
Updated 22 April 2024, 8 months ago

Problem/Motivation

Need to use parameters for sort expression.

Steps to reproduce

Can't create sort expression like

"CASE node.nid = @some_param THEN 1 ELSE 0 END"

Proposed resolution

To make the sort expression with parameter's replacements. For example:

"CASE node.nid = @arg1 THEN 1 ELSE 0 END"

will be replaced second view parameter into value.

Remaining tasks

  • Create parameters list using view object

User interface changes

To add a notice about using parameters into the sort expression's description.

API changes

To use a string with placeholders (parameters) as sort expression instead a simple string.

Data model changes

None

✨ Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine goodboy Kharkiv, Ukraine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡·Argentina hanoii πŸ‡¦πŸ‡·UTC-3

    After coming back to this module a long time, and looked at this issue, I think is a bit too complicated for the module. Not codewise, as the code is simple enough, so thanks for that, but support-wise, as I can see this nor working as expected in many scenarios are views arg are not always so literal.

    Besides, the views argument sometimes gets into the sql so there might be ways this can still be used in the sort argument. If we were to add this I would like to have tests or something with different kind of arguments to make sure we are doing things properly.

    Finally, formattedText seems and odd use case for this kind of things.

Production build 0.71.5 2024