What is the best way to make a parallel list?

Hello all,

Quick question: What is the best way to make a parallel list? Should I separate the items by comma and use the replace.text and split.comma blocks or should I have two separate lists with corresponding indexes using the selection.index block?
This will be a list I will be constantly editing and adding to in the app, (it will be bookmarks for a browser), and will also be shown in a list picker.

-Thanks for the earlier help, and advice from y'all-

-Happy holidays,¡Felices Fiestas!, 节日快乐, Laethanta saoire sona!, 幸せな休日, Boas Festas!, Li holide eximnandi!, Forhe Feiertage!, and adios,

-NetminderNo.9Apps

how about a list of list?
or Dictionary is also a good option. item from one list as key, other as value.

Hmm :thinking:..... I haven't used the dictionary component yet in app inventor.@Kevinkun Can you show the dictionary entries in a listpicker, like side-by-side?

This is similar

1 Like

@ABG Thanks.

As a reference to others asking the same question.....
Here's what I did:
List 1 (bookmark URLs):


List 2 (named bookmarks)

Blocks for the actual process:
Screenshot 2020-12-08 at 12.25.49 PM
Code for making the bookmark name editable:

or

(the x is because they are duplicates in the same program.)
@ABG and @Kevinkun, What do you think?

I prefer the laziest way possible.

Keep two TinyDBs, with different NameSpaces:

  • Bookmarks
  • Bookmarks_Edit

They are inverses of each other, and you need to do double maintenance (a little bad) with the benefit of having GetTags lists available with no loops, to populate Elements lists.

  • The Bookmarks TinyDB has Bookmark tags with BookMark_Edit (URL) values.
  • The BookMarks_Edit TinyDb has BookMark_Edit (URL) tags and Bookmark values.

If you weren't updating the TinyDBs, I would instead load two inverse dictionaries and take keys() instead of GetTagLists.

1 Like

Why not run a list of lists: one list with sublist, first item bookmark, second item bookmark url ?

image

While we're piling on to the topic, it occurs to me that I assumed a 1-1 correspondence between Bookmarks and URLs.

What if some Bookmarks had more than one URL and some URLs had more than one Bookmark?

In that case, the only recourse would be to keep a 2 column table (list of lists) (Bookmark, URL) and filter rows by content of either column.

1 Like

@ABG, @TIMAI2, Thanks a lot! I didn't think of doing the list of lists for the bookmarks. I'll try that out for my app.

@TIMAI2 How would you make folder of bookmarks using these blocks? Any suggestions?

Get the first value (index 1) of each of the sublists

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