How To detect changes in a ListView. When a change is detected notify as a message of the changed rows.
The list in a ListView does not change by itself. It is the code created from blocks that changes the list in the ListView. Therefore, before loading the list into the ListView, compare the new list with the old list to see what has changed. The ListView does not have blocks to check what has changed.
you're right. I'm using Google sheet
when I change Status "Pending" to "Active" I'm getting changes on my Listview when I click update button on my app side. Now I Would like detect changed row to see on as message. How to do?
Do the rows only change or can a new row be added in the middle of the list? Or maybe new rows only appear at the end? You would have to iterate through the list and check element by element if they are the same.
When I click update button I would like to detect only changed rows (on a Listview or as a message
).
In its simplest form it is something like this:
or like this if you want to display changed rows instead of just their numbers:
Detection of changed rows can be made easier by keeping a datetimestamp on each row of the sheet.
Filter the sheet by timestamp against some high water mark to track what changed.
P.s. if this is not granular enough, you might need to keep a separate detail sheet with only the frequently changing columns, one row per change.
You indicated your issue was solved. However you get this error message so something on your ios device is NOT working. What were you doing when the Runtime error displayed?
There is no ios so I can't check what this error is about. When does this error occur? Are the old and new lists the same length?
It seems that, according to the error message ("get item nr. 1 of a list of length 0"), the problem could be here ?
I used this
now it's working but when I'm adding new item it's adding to my google sheet
then when i click update Listview it's showing this error
you're right. How to fix this issue?
Dear @Samhappy,
sorry, but I have no time today to check your entire code, but what I see is that the last error message is always the same as before: you try to get acces to a non-existent element of a list ("out of bound" error). To avoid this type of errors it is a general practice to check the lenght of a list before any operation (unless by adding elements) on that list, especially if you remove, or change position of an item. It seems to be boring, but this avoid ultimately the runtime errors. And allows you to detect anomalies, while debugging if, for example, you raise a popup when you would try to get access out of the limits of the list. (i.e. defensive programming )
See those questions I asked earlier? I didn't answer that, and that was about this issue.
I advise you to pay more attention to what someone is writing and what they are asking.
Focus on this too. It can be easier to check for differences in the lists.