Reads three files in a row, but at least one read fails

Hi,

First of all, I wish everyone happy holidays!

I would solve the multilingual nature of my application using JSON files.

By extracting lists from these JSON files, I would use any blocks to define labels, buttons, and other components individually.

I divided the labels into two separate groups because my application works in two modes, and accordingly, some labels can have two different texts.

I put labels into lists using blocks.

I extract the text of the labels from the JSON files in the form of a list.

That way - I think - it's easier for me to give each label the appropriate texts.

My only problem now is that out of the three JSON files, only the first one can be read, the second one cannot, and I haven't even gotten around to reading the third one.

How can I ensure that reading three JSON files is successful and then successfully defining the labels' texts using my method mentioned above?

I am attaching the relevant blocks and a screenshot.

I am also attaching the three JSON files.












en_CimkeSzoveg.json (11.7 KB)
en_CimkeSzoveg_EgynsArnysg.json (133 Bytes)
en_CimkeSzoveg_FordtotArnysg.json (135 Bytes)

I almost forgot the error message:

Runtime Error

Select list item: Attempt to get item number 0, of the list ["Direct proportionality", "Direct proportionality function graph"]. The minimum valid item number is 1.
Note: You will not see another error reported for 5 seconds.

I appreciate all advice!

All the best! Pali

This gets simpler if you generalize it to a big number of JSON files and TinyDB tags and Namespaces.

Keep tables of tags to check and matching JSON files to load if the tag/value is not there yet.

Do a scan of the table at startup to build a queue of files and TinyDB destinations that will need to be loaded, along with their key tags and Namespaces.

Use a single file component to work the queue, one at a time, depleting the queue until it is empty.

Once the queue is empty, open the curtains, end the overture, and let the show begin.

1 Like

Slightly long-winded, but shows how to read and handle each json file in turn

1 Like
1 Like