Put text file in listView

hi i have a 2 texte file:
1-the first i want to put it in the list view i mean each line in text file is an item in the list view
2- when user click on the item list view an other screen opened
3-here label shown with an explination of the item selected by user this explination is in the seconde texte file
this an image for content of txt file 1


texte file 2

The second file can be used to populate a TinyDB NameSpace, with tags made from the lines that begin with numbers followed by a period (.), and values consisting of that line until the next tag line from the file.

You would need a loop over the file text.

The tag list would be your Elements list.
After selection, load the TinyDB value from that tag.

To detect if a line is a tag, split it at first '.', and test if item 1 is a number.

1 Like

to do that what do you think i need 2 screen or just one is enought

But watch out for the difference between lexical and numerical ordering on the tags.

You might have to skip the TinyDB and just load Elements as you scan the file text.

On further examination, it looks like your tags work in lexical order, so TinyDB is okay.

1 Like

I'm trying to understand the split function but is not work with me
image

Have you learned to work with lists yet?

The first text split you need is at \n to get a list of the lines into a global variable (call it Lines).

You will need two variables:

  • CurrentTag, to hold the tag you will use for TinyDB once you have filled a Paragraph with text
  • You also need a variable called Paragraph, initially empty text, to hold the current paragraph you are building.

Pseudo-code (make it in blocks)

(in the event that catches the File text)

for each line in global Lines
   init local SplitResult to (split line at ':')
   if is a number (select item 1 from SplitResult) then
      save to TinyDB (CurrentTag, Paragraph)
      set CurrentTag to line
      set Paragraph to line
  else
      set Paragraph to text JOIN(Paragraph, '\\n', line
end for each
 save to TinyDB (CurrentTag, Paragraph)
1 Like