Ternary Operation not works in Server Side

Wappler 5.1.0 | Windows 11 | NodeJS

Hi,
I’m Trying to do any ternary operation inside any server action API in a “Set Value”, and when save it converts in bad format with plus sign.

From this:
new_query==1 ? 'New Text' : 'No text'

To this after apply:
new_query==1+?+'New Text'+:+'No text'

v5.1.0, MacOS, NodeJS

This is happening in the App Connect Ternary Operations as well. It happens after a formula has been saved and reopened for an edit, even when the plus signs have been removed in the Design View or in the dynamic picker.

You can wrap the expression in brackets as a workaround but a fix would be very welcome.
E.g.
(new_query==1) ? 'New Text' : 'No text'

2 Likes

Not working, after applying, Wappler add plus signs between “?” and “:”.
Right now the only workaround is changing directly in the .json file.

Bump++

This is a pain in the ass. I end up yet again editing JSON files to avoid this

The work around is to put the entire ternary in between parenthesis:

($_GET.title ? 'abc' : 'def')

Just tested in 5.1.0 and works fine.

Agree that a fix would be nice. :slight_smile:

6 Likes

Fixed in Wappler 5.1.1

This topic was automatically closed after 31 hours. New replies are no longer allowed.