Filter Data in List View?

I'm building a barcode scanning application, and I want to filter the data based on the scanning time.
My idea is to build two list views: listview_1 will contain all the scanned barcode data, and listview_2 will display the filtered results from listview_1. Additionally, when I delete data from listview_2, it should also be removed from listview_1 (similar to a parent-child relationship).

Currently, I have successfully filtered the data from listview_1 to listview_2, but only the main data is being displayed. The detail data in listview_1 is not showing up. Moreover, the results are being displayed with multiple line breaks. I have made adjustments and referred to several posts, but I haven't been able to resolve the issue.

Below are the AIA file and the screenshot. I hope someone can help me with this problem."

.
Scan.aia (4.9 KB)

Tôi nghĩ vấn đề nằm ở chộ khoanh đỏ này

You need to use CreateElement also for ListView2 if you want a Main and a Detail texts in listView2.

Try with this:

1 Like

t's really strange, but it worked out. I made some adjustments based on your suggestion. (Initially, I tried sorting it similarly, but it didn't work.)
Thank you very much.
Here are the AIA file and the image, in case someone needs them in the future
Scan.aia (4.8 KB)


1 Like

I looked at your code.

You don't use any kind of data base or file storage, so you will lose all your data when you close your app.

If you ever decide your data is worth keeping, keep the dates as Milliseconds from 1970 , like Clock1.SystemTime.

That works much better with range comparisons, and can be reformatted for human display.

2 Likes

Thank you, this is new knowledge for me. The provided excerpt was shortened for better understanding of my needs. In reality, there are many issues, and I have set up storage using TinyDB. However, I sometimes encounter an error notification like the one in this post: https://community-appinventor-mit-edu.ezproxy.canberra.edu.au/t/error-argument-to-makeinstant-should-have/89849

I'm also wondering if the usage of Clock1.now and Clock1.SystemTime is related to the error. Could you provide an example of how to implement storage? In my code, can I replace Clock1.now with Clock1.SystemTime?

Additionally, my application has another functionality that I'm seeking a solution for. When I delete data in listview_2, the corresponding data in listview_1 is also deleted, and the deleted data is stored in listview_3 (a recycle bin). In listview_3, there is a functionality to restore the deleted data from listview_1. This transition sometimes causes the "Argument to MakeInstant" error mentioned in the attached post.

The error is because you are providing a wrong format parameter to MakeInstant block...with no more detail...it is difficult to say more.

1 Like

Use the Companion Do It facility to see the content of an Instant and a milliseconds value.

They're very different .

Also, learn to keep data in variables for filtering and hold off on loading Elements until the tables and to lists are filtered.

1 Like

Thank you @Ramon and @ABG for helping me. I will make an effort to find a solution based on your suggestions. If it truly isn't possible, I will create a new topic.

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