Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression to get other value if main value is empty string #14

Closed
wants to merge 2 commits into from

Conversation

gdebrauwer
Copy link
Contributor

The Coalesce expression allows you to get the first non-null value. But what if you want the first non-empty value? This PR adds an expression for that. I named it ifempty to make it similar to the ifnull database function (I don't know if adding an ifnull-expression is interesting, as an alternative for coalesce?)

new IfEmpty('name', 'email')

@tpetry
Copy link
Owner

tpetry commented Sep 1, 2023

The idea is interesting. But I am not sure what the behaviour should be.

how should it react to NULL, '', [], {}. I am not sure whether this opens up a nest of issues and the more verbose CASE WHEN idea from the discussions would fit better.

For the moment I try to stay as close to the SQL standard as possible because their behaviour is stated by someone else. Bit thanks for the idea.

If you want to add more, you can also first start a discussion to share your ideas 😉

@tpetry tpetry closed this Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants