Lists: lookup in pairs manager library

307 views
Skip to first unread message

Scott Ferguson

unread,
Oct 12, 2015, 10:24:22 PM10/12/15
to app-inventor-de...@googlegroups.com
The procedures in this library provide some convenient tools for working with lists of Key,Value pairs.

Create a global variable and set it's value to the empty list to hold your list of pairs.

Then you can use any of the following procedures to manage the list:

CreatePair(Pairs,Key,Value) - create a Key,Value pair
RemovePair(Pairs,Key) - remove a Key,Value pair
SetValue(Pairs,Key,Value) - set the Value associated with Key (pair must exist)
GetPairIndex(Pairs,Key) - returns the index of the pair
GetKeys(Pairs) - returns a list of Keys
GetValue(Pairs,Key) - returns the Value associated with a Key

Copy these procedure blocks to Backpack for use in your projects.

The Examples file contains example uses of each of the procedures.

---
sf



Lists_PairsManagerLib.aia
Lists_PairsManagerExamples.aia

Abraham Getzler

unread,
Oct 12, 2015, 11:16:15 PM10/12/15
to app-inventor-de...@googlegroups.com
Could you add these to the Gallery too?

I have trouble getting to the Developers library.

ABG


On Mon, Oct 12, 2015 at 10:24 PM, Scott Ferguson <scottfr...@gmail.com> wrote:
The procedures in this library provide some convenient tools for working with lists of Key,Value pairs.

The library file's procedures can be copied to Backpack for use in your projects.

Create a global variable and set it's value to the empty list to hold your list of pairs.

Then you can use any of the following procedures to manage the list:

CreatePair(Pairs,Key,Value) - create a Key,Value pair
RemovePair(Pairs,Key) - remove a Key,Value pair
SetValue(Pairs,Key,Value) - set the Value associated with Key (pair must exist)
GetPairIndex(Pairs,Key) - returns the index of the pair
GetKeys(Pairs) - returns a list of Keys
GetValue(Pairs,Key) - returns the Value associated with a Key

Copy these procedure blocks to Backpack for use in your projects.

The Examples file contains example uses of each of the procedures.

---
sf



--
(you have received this message from the App Inventor Developers Library)
---
You received this message because you are subscribed to the Google Groups "App Inventor Developers Library" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
ABG
(Personal emails from boards are auto-spam deleted)

Scott Ferguson

unread,
Oct 13, 2015, 5:12:55 AM10/13/15
to App Inventor Developers Library
OK :)
---
sf
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-developers-library+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages