Antony
November 13, 2020, 12:33pm
1
I have a server connect called get_payment.
I then want to display a string like this:
<p dmx-text="get_payment.data.payment.description.HAS_A_VALUE() ? get_payment.data.payment.description:'A Message'"></p>
I want .HAS_A_VALUE() to be false if:
get_payment returns no record
get_payment returns a record but the description field is null
get_payment returns a record but the description field is an empty string
How do I do that in Wappler?
Teodor
November 13, 2020, 12:39pm
2
What is the data in your server action?
get_payment.data.payment
is this a database query or something else?
Antony
November 13, 2020, 12:40pm
3
HI Teodor…
Yes, it is a mySQL database query…
Teodor
November 13, 2020, 12:40pm
4
Is it a single or multi results query?
Teodor
November 13, 2020, 12:48pm
6
Well then this should do the job for all the three conditions:
<p dmx-text="get_payment.data.payment.description ? get_payment.data.payment.description : 'A Message'"></p>
Antony
November 13, 2020, 1:53pm
7
Oh that is interesting… so you can do a true/false test just on a text field from the database? And it returns exactly what I am looking for?
Can you do the same thing for a number field too? In that case, will return false in situation (1) or (2) from my list?
Teodor
November 13, 2020, 1:59pm
8
Using the expression as a condition get_payment.data.payment.description will return true if the expression exists and returns a value which is not empty or null.