Single query not returning output when in globals

Wappler version: 3.9.7
Windows 10
Node
Docker/ MariaDB

Not sure if this is me or a bug

I have a number of globals set in relation to a site

image

The highlighted query, query_subscriber, checks to see if the current use falls within the role of subscriber (role = ‘S’)

image

This is set as a single query returning either “S” or Null if not a subscriber

Output is set

However checking the dev console i see no output from the query_subscriber at all

If i change the query to a multiple records query

image

Then dev console shows an output

image

Anyone any idea what is going on?

After further examination it looks like what is actually happening is if a record is found then the data is returned by a single query but if not found no output at all results where i would expect the query to be returned but with no data i.e an empty data set

Is that correct?

That confused me too! I think something has changed recently; I’m sure it returned null before now.

I also noticed this sometime ago, but then my steps changed so did not dig into it.
It could be a change in the way Wappler handles null output.
@patrick would know.

A normal query returns an array and an empty array when there are no results. Using single query the record object is returned and when there is no result it returns NULL.

The output from the global and the action are being merged together, perhaps the merge is ignoring the null values. Will have a look at it.

2 Likes

Hello everyone,

I have the same issue but bigger. I tried single, multiple and even paged query. None of them are returning the output.
Any suggestion on how I can fix this situation.

@Hyperbytes @George @patrick @sid

https://quickbitethaisushi.com/blogpost

I think I found the problem. But I cannot find the solution:

There is error in line 2. However, when I check the connection to the database. It is working. It just does not return the input in the database.

There is something wrong with your server configuration from the looks of it.
Re-deploy the app and try again.
Or, if you can run it locally on your machine, that would be the best test of your code and would confirm the issue being on your deployment and not Wappler.

Also, given that this is completely unrelated to the post here, it would be best to open a new post in the future.

Thank you! I will test it and let you know. I will also try to create a new post if It does not work.

1 Like