Load reading txt file

I am facing a problem when reading from a text file when I put the code to bring me the result it takes from 5 to 7 seconds I did not know how to solve the problem.

It looks like you are trying to read a very big text file?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Yes is big file 40000 record is there a solution

You should load your text file to your variable when the app opens (use a progress dialog to amuse the user), then your "query" should run much faster.

You cannot, however, expect the world when working with a large amount of data. Using sqlite to store the data may be a quicker solution.

please give me an example of the first answer?

Searching an item in a large list takes its time...
The sqlite database offers a fast search and filter functionality...

Where does your items.txt file come from?
Does it change frequently?
If yes, how often?

If you want to follow the sqlite approach, you could import your database from the assets on first run of the app and later query the items table like this

SELECT name, price FROM items WHERE code = item_code.Text

to get the name and price of your item code

Taifun

2 Likes

The file comes from one drive daily, it is modified

And how does it come into your one drive?
Probably you get it from a server database?
You also can access server databases from within your App Inventor app...

Taifun

Yes, I get it from Google Drive from the .db database, but there is a problem with the database. The items are separated by two files, so I export to a text file to read from it

?? db.database ?

Paradox table

Suggestion: When I send a small text file, the number of lines is 25000, the result is within one second, can I put them 40000 lines in one line, can the problem be solved or the same result

Second suggestion: Can I import from a text file the complete information into the database on mit app inventor and then read from the database?

I don't think so...
Try to search for the last item code in the table... this is the worst case scenario...

Not like this

Are you talking about that database?

There might be a sqlite extension available, which offers bulk inserts... my sqlite extension does not offer this..

Taifun

Thank you very much