2017년 7월 13일 목요일

Maximum number of items in a list?


For a simple app that displays a random string of text when a button
is clicked -- is there a maximum number of items that can be placed in that list?

Assuming I'm missing something relatively obvious (entirely possible,
as I'm pretty n00b to this) -- is there a better way than

LABEL.TEXT>>>PICK RANDOM ITEM>>>RESOURCE LIST OF ITEMS

for displaying one of any number of random text strings? (but again:
what's the upper limit of "any number"? and is there an efficient way
to have an upper limit that's in the hundreds, not the dozens?)

--
Check this thread: http://groups.google.com/group/appinventor/browse_thread/thread/c708b24339ec5b3c/0034be0d8649f895

There's some arbitrary talks about this very topic and it appears to
be restricted only to the available memory of your phone.  As for
picking a random item from a list, I'm not sure that it gets any
easier than say "pick a random item from this list".  The block
functions the same as "from 1 to X, where X is the upper bound of list
L, select random N form list L".  Again, one block does the functions
of several (if you were to do it yourself) so I'm not sure how it
would get any easier. 

--
Thanks, pupooh ... it does appear that the limit is 56 -- because that
maxes out the available space on the blocks editor landscape.

So, to simplify the issue: If I have a button in the app that says,
"click here to see a random baby name" then the maximum number of
random names available to choose from appears to be 56

--
To be honest, there are two ways to do this to bypass limitation I
think.

Both involve the use of TinyWebDB.

The first would be use the TinyWebDB to load TinyDB with data. Then
when the button is pressed, a random number helps generate a tag that
you can get that can be use to pull a baby name.

The other would be to just use TinyWebDB with the getvalue function on
the server simply returning a random name.

The ideal way to handle this would be to have a TinyDB or similar that
you pre-populated with data that you can include with your
application. As far as I know, that is not yet possible. 

--
No, no,no

You can have a list of 1000+ items

set up a While Loop , while i < 1000
i = i + 1
Add item to List, listname=name, item to add="abcd' + i

you can even make a 2 lists of 56 items and use Append to list to make
a list of 112'

see https://sites.google.com/site/blocks123/lists
and https://sites.google.com/site/blocks123/playing-with-colors 

--
Yep -- APPEND TO LIST is what I was looking for, and should work well
for my straightforward purposes: I can create multiple lists, append
them all to my main list, then have the app pull randomly from that
main list. Here's how I'm doing it (tested on my Samsung Galaxy and
it's working perfectly)

http://ckpcreative.com/_ckp/appinv/screenshot_append.jpg

Good site, by the way, Ed: Thanks for posting and sharing! 


--
ah so that's what you were going after.  :)

either "append to list" or "add items to list" blocks work.  with "add
items to list" you don't need to create multiple variables to store
your list.  just have a multiple procedures instead that makes the
"additions" and have those procedures be called in the
Screen1.Initialize event. 


--
I have several iterations of my app that has data in one or more
lists. The data comes from a spreadsheet with 144 rows. Each row has
10 columns. That ends up as over 1400 list items.

The last version loads the data as a string and uses the split block
to split the rows with a '#' between each row and a '|' between each
cell from the spreadsheet.

Here is a draft of my list of lists tutorial
http://code.google.com/p/resource-calculators/wiki/fbLists

My next versions will (probably) use TinyWebDB. You would have to set
up a Google App Engine (GAE) to run your version of TinyWebDB, but
that is not hard. Then you could use the web interface to load your
data and get a random key from a list of the keys.

That cuts down on code blocks
May be a bit easier to code (may...)
and requires the user to be online. Hmmm...

Using TinyWebDB and GAE lets me do the editing with a web interface
and AI will work with the rows I am using as needed. That seems to be
a better way to split the load. The phone does the stuff the user
wants and the web page does the editing.

The current version does not need to be online. Using TinyWebDB makes
it necessary to be able to have a connection. Not a problem for now,
and I will look at TinyDB to persist a copy on a phone once I have
TinyWebDB working as I want it to work.

I think I got carried away with this post :-)

--

댓글 없음:

댓글 쓰기