If then else block not working properly

The Else block does not work because it is not emitting NOTIFIER when the IF comparison is FALSE.
This occurs when the RESPONSE CONTENT return is empty.
I have already put this RESPONSE CONTENT inside a textbox (to debug) and the textbox.text is empty (I forced this using a select that returns empty).!
Being FALSE, it would have to issue NOTIFIER.
What can it be ?!

ELSE

Hi
Are you sure you want the “not” block in there?

There are two possibilities: SELECT SQL returns with rows or return empty.
1-In the case of returning rows, I’m already showing in the listview.
2-In the case of returning empty, send message. And it is returning empty, I checked it and it still does not enter the ELSE.

Going by what I have understood, you want to show the dialog if the text is empty.
I suggest you replace the compare texts block with the is empty block

Just figured out what’s wrong with your code.
In the compare texts block, remove the quotes in the text block.

A text block with nothing in it represents an empty text block.

This away ? Still does not send the message when return is empty…
EMPTY

I’m not sure why this is happening, I’ll take a look

1 Like

Any news , @Vishwas ?

The if…then…else blocks are working fine for me.
If you don’t mind, could you share the AIA (or at least this particular part of it)?

Condominio (5).aia (112,7 KB)

Of course, what is the best way for me to share?
Just to inform, I use MAKEROID with COMPANION, emulating in my Moto G 4
and has a database with some tables. The table for this application is simple: id field, nvalue field, description field, nmes field, dpaago field.
I also use XAMPP.

You can upload it right here.

Ok, I’ve already attached it in the previous message.
Along with the code MAKEROID use PHP script.
Thank you.

I will look into it and get back to you soon!

1 Like

Hi.
I’m forcing SELECT to return empty and does not.
This happens even with the simplest SELECT.

Bloco de citação
$c_cpf=$_POST[‘c_cpf’] ;
$c_anoletivo=$_POST[‘c_anoletivo’] ;
$db = new Db();
$dados=array();
$sqlBusca = ‘SELECT Tbdiario.ncodaluno, Alunos.ccpf, Tbdiario.cn1, Tbdiario.cn2,
Tbdiario.cn3, Tbdiario.cn4, Alunos.cnomealu, Tbturma.cletivo FROM
dbcadastro!tbdiario
INNER JOIN dbcadastro!alunos
ON Tbdiario.ncodaluno = Alunos.ncodaluno
INNER JOIN dbcadastro!tbementa
ON Tbdiario.ccodementa = Tbementa.ccodementa
INNER JOIN dbcadastro!tbturma
ON Tbementa.ncodtur = Tbturma.nturma
WHERE Alunos.ccpf = ‘.$c_cpf.’ AND Tbturma.cletivo =’.$c_anoletivo ;
$resultado = $db->query($sqlBusca);
if ($resultado)
{
while ($array = mysqli_fetch_assoc($resultado))
{
$dados [ ] = $array;
}
echo json_encode($dados);
}
else{
echo “bla bla bla bla”; //
}
Echo ->>>>>>> This string is the return (RESPONSE CONTENT) and in the code block I show inside a textbox.

1- When I change this return string to echo “” (empty) it does not show the message SHOWMESSAGEDIALOG BLOCK and error occurs “The second argument to foreach is not a list. The second argument is: empty-string

2- If I keep the contents “bla bla bla”, the message bla bla bla is displayed in the textbox and the error occurs (of course) because it is not a JSON format.

Hello. I changed the IF THEN comparison / test … The 2 IF’S do the same test. I’ll take one of them out. One I checked if the string length without spaces (TRIM) is less than or equal to 2 (empty return JSON “[ ]” ). The other IF I compare if the return JSON is equal to “[ ]” ). IFFUNCIONANDO

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.