How Do I Check a Server Connect Field String Exists?

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:

  1. get_payment returns no record
  2. get_payment returns a record but the description field is null
  3. get_payment returns a record but the description field is an empty string

How do I do that in Wappler?

What is the data in your server action?

get_payment.data.payment

is this a database query or something else?

HI Teodor…

Yes, it is a mySQL database query…

Is it a single or multi results query?

Single. Hence no [0].

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>

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?

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.