Remove Special ID item of Dynamic component list

What about providing a screenshot of your relevant blocks?

Which database are you talking about?
Well, you like to delete the last item, so before deleting that item it still is there, isn’t it?

Taifun

Greetings Taifun, it’s correct, but after disassembling and assembling the blocks so much, I realized that the error is there that Web1 get response content receives the empty list and if there is nothing it does not show anything without error, that is the solution. I tried to send some defined values ​​from my api and they did not arrive, this error has me without hair, I want to solve it to continue…

here are all the blocks I shared



blocks(38)

I now merged the 2 threads
Taifun
.

1 Like

Sorry I’m not one to be in communities, I just read everything they publish and I follow the tutorials and what they share and from there I look for my answers and move forward, sorry if I came back a disaster writing in several parts it seemed to me that they had to do with me subject and how they are separated, thanks for correcting it for me… I’m sorry, what a pity…

How does the response content look like after deleting the last item?
The error then seems to come from the ParseJson method…
What about adding an if statement before calling that method?

Taifun

As my api does not send anything because it no longer has an item because it was previously deleted, parse json does not update anything and shows the last remaining item…
I tried to do this from the api to receive some other value to leave it there when there is nothing in the item but it doesn’t work. and it is correct the ParseJson method indicates that it does not receive arguments, so how to tell ParseJson that it does not matter if it is empty does not show anything so that the change is definitely empty



Unfortunately you did not answer my question

To find it out, display it in a label

Taifun

when there is still 1 item

this is all that happens after deleting the last item
after this I refresh the screen and everything is deleted

here add create empty dictionnary. also imagine the last situation, there is only one item is there and you are deleting if so what will be the length of the json and what you will store it in tinydb?

1 Like

Hi RSG.

if for example, there is an index left and it is 1 and it eliminates it, it remains at 0 or empty null, and this is what it should show or not cause an error at least show 0

cart_cant is a label to display the number of items next to the shopping cart in the top red bar of the app

i feel here is the problem…
image

so when the length is not equal to zero you should make this field to trigger. so when the web got text try to use one if then else

If call JSONTools1. Get CurrentArrayLength is not equal to zero
then
image

Else throw notifier, the list is empty

I keep getting the Runtime Error Argument must be valid JSON because ParseJson still doesn’t receive anything, I think the solution is to put the response in a variable, do something with that variable and have ParseJson look in that already modified variable to avoid getting an error

do one thing, On delete label try to catch the response in a label Dot add the parse json string and the call lists_detalle procedure simple use set label text to to response content

I am building something similar but with a variable, my idea is, if there is data, show it, otherwise if there is no data, use the variable that I will put with information that I want to show, your idea is similar only with a label, I do not understand much is capturing the response in a tag, I understand that you want to achieve what I don’t know how I could achieve it

on clicking the delete item you are posting the delete function into php and items are deleted fromphp then you are returning something, that return only we are asking to print in label before the procedure getting trigger

1 Like

Unfortunately you still did not answer this question
.

Of course we are interested in the value which will be returned after deleting the last item .

And then only call the ParseJson method if you ger a reasonable response content back from the Web.GotText method

Taifun

1 Like

what you are returning with this last change is error 1105 unable to decode JSON text. I put the return in a variable and show it in a label

the white box says that

Ok, try like this atleast and i feel using JSONTools is no need just with the help of default block you can build up the list

i have tried this json structure

[{"id":"47",
"cantidad":"1","nombre_producto":"MechadaBurger","precio_u":"5.00","precio_total":"5.00","total":"5.00","eliminar":"&#xf1f8"},
{"id":"47",
"cantidad":"1","nombre_producto":"MechadaBurger","precio_u":"5.00","precio_total":"5.00","total":"5.00","eliminar":"&#xf1f8"}]

image

ok i will try it

Where do these last two blocks go, in the global variables of each item?

you are using add items to the list, but this method will create list automatically so you will feel fraction of time faster than earlier method

move all teh set global variables into web got text fi the response content is not empty

1 Like