Display Single query

I have a simply server connect. Over console I can see the query: ‘total record’

But on page.

<div dmx-text="videoBack.data.query.videoName"></div>

Displays in white all. No tada is showed. Any help?

Hi,

If you read carefully, you will see that query is an array.
This should work:
dmx-text="videoBack.data.query[0].videoName"></div>

In addition to what Sid says, if you are using the data picker it will generate the correct expression for you.

1 Like

The problem is that I am using a Rand order so is a custom query

SELECT videoName
FROM `videos-back`
ORDER BY rand()
LIMIT 1

Even is if a single wappler takes like a multiquery.

That is because custom query action in Wappler does not know if the output is going to be single or multiple or no output.
If you know its going to be a single row everytime, you can switch off output on the query, and bind the 0 index value in a variable action in Server Action itself and enable output on that.

You will get direct binding on client side in that case.

I get it. Thanks a lot.

1 Like

One last question. Whats the difference between name and Global Name. Any use for this?

Name is the custom-name of the step, which is also used for binding in below steps or output.

Global name in variable action step allows you to keep same variable with different custom-name.
If you make multiple variables with different names, but same global name, each step will override the previous value.
Its more of a convenience feature when you have repeats or complex flows.

1 Like