Where clause using integer

Hey I have no idea why I can’t get this to work. I can get the where clause to work when searching the objectID but not when I am trying to filter by a integer in the TableID column.

Hi @Chad_Wyatt,

what’s your app ID?

Is TableID column type of INT or STRING in the DB schema?

By the way, there is a Get First object from table block that suits your purposes better:
UI Builder - AAA_TEST - Backendless 🔊 2022-08-24 12-08-34

TableID is an integer.

Yes I was using the Get First object but I need to get the first record where the TableID (table as in playing table not DB table) is = to the screen displaying the game for that table.

So there might be people playing the game on Table 1, Table 2, Table 3.

Each instance of the app needs to return the first record specific to the table

What’s your app id?

Where do I find it?

Found it

E21078EB-3A9E-0957-FF7C-B6F56176DF00

Thanks.
I don’t see the where clause in the function you posted here. Did you remove it?
Also by saying “have no idea why I can’t get this to work.” what do you mean exactly - do you receive any error or just an empty response, or … ?

Yeah so I am recieving an empty response even tho I have one record in my DB with the TableID set to 1…

Let me check and put the logic back if it is missing

I’ve put the logic back and there is a record in the DB with the TableID and value 1

Thanks, see it now.
May I ask how you know that the response is empty?
Have you tried to put the Print Text block with the locations variable after loading to see its value in the logs?

So if you load the page with kiosk in the name you will see 2 scores come up.

If i don’t have the where clause. The score displays. With the Where clause then the scores do not display.

However I am experiencing some wierd behaviour now that if I come from a different page, the numbers display.

On a seperate note, I am experiencing and incosistency with a button that is not working on the first click but is on subsequent clicks.

It’s could well be user error on my behalf but I’ve spent a couple of hours trying to work out what is going on

Let’s divide the problems into points, so it will be easier to understand so as not to mix everything together.
Now we are in the context of a problem with loading an object by where-clause. I am absolutely sure that if you add a log with the output of the variable result, you will see in the browser console that the value was successfully loaded, which means that the problem is most likely somewhere else further. The best way to debug is to set up logs and see what values are there, and if some value does not match the expected one, start digging in that direction.
The Print block is under the Text category.

Great suggestion and upon putting the print text on the page I can confirm if there where clause is present and I refresh the kiosk page I get no data. Strangely the timer that calls this function doesn’t run either.
However if I remove the where clause, all is well.

To add another spanner, if I navigate to the kiosk page from another page, the where clause works fine.

It appears this error is causing it to fail to load.

Screen Shot 2022-08-24 at 9.43.22 pm

Strangely the timer that calls this function doesn’t run either.

I don’t see any timers in your app…

Or do you mean another timer, maybe in your code?

Let me try to play around with your code to gather some information. During this time it’s better to not open the UI Builder tab since we may run into conflicts in the changes.

I need to head to bed, it’s a bit late here.

Maybe it’s not called a timer.

I understand your time is valuable, so thank you for helping out.

If you have time to look at the second issue, you would replicate it by

  1. going to the createTeams page.
  2. add 2 players for each team
  3. press the select game
  4. choose any game
  5. you will now be on the kiosk page and there is a button down the bottom that is suppose to simulate changing the turn of the player. First player is red 1, then blue 1, then red 2, then blue 2, so on and so on and then it will go back to the start.

It works fine except for the first time you push the button nothing happens. After that the button works as expected

The issue comes from the On Page Enter logic:

Here there are now bluePlayers in the App Data yet, thus the error occurred.
I don’t know your logic (how/where/when the bluePlayers should appear in the App Data).
Try to figure it out tomorrow. We’ll be here in case of any further questions.

Regards

It comes from a previous page, which makes sense!