Put text file in listView

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