Validate label value in if else conditions

I know it’s simple, but I don’t know where I’m going wrong.
I think someone has been through this. I’m trying to validate a return from a mysql query coming out in a label.
if it returns null I wanted to display a message, if it returns with value it would be another message, any suggestions?
image

In your script in host , What are you returning from your script? “null” ?
Json ?

In web got, you will have to use response Content (this is where you will have the data returned from your Script). You can use the response code to check the return code
You can use the Json Decode text Block to handle Response Content.
You can use dictionary blocks.
You can use lookup pairs Key together with Json Decode text to get values by key …

Unbenannt

probably the response Content is Null or NULL or something else? use Do it to find it out and show us your Do it result…

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun

2 Likes

Oops, again, sorry and thanks for the help, yes rogerio, when there is no data in the database, I return it as null, and I leave the content of the response to a label to validate it.

if I don’t insert an if , to check the values ​​that aren’t nullos it returns this error.
image

the content of the response is null (when there is no value in the database).

1 Like

how does your php script look like?
in case of null my solution returns an empty string…
https://puravidaapps.com/mysql.php

Taifun

2 Likes

That’s not what I showed in the image…
Look at your error message…is it a list…?

Thank you for your help.
is returning as null taifun

what about returning an empty string in this case?
Taifun

yes rogério , this list message is occurring when the return is nullo, when I have nothing in the database. that’s why I wanted to validate this condition before foreach

[image]

I’ll try
ok

image

Did You check If there is space in red block " null " ?

thank you rogério, I’ll take the tests at night, don’t worry, I’ll read about it and give you feedback

ele me retorna como null sim rogerio o content response, antes de eu passar para o foreach eu precisava do validar com o if, para não dá erro.
mas fique em paz ai …

Well :+1:maybe you are not understanding what I wrote.
Hugs

Hello friends,
follow the solution
tks taifun,rogerio.
Thank you for your help.