Choices, Choices, Choices

Thomas McGrath III 3mcgrath at adelphia.net
Tue Feb 24 08:09:27 EST 2004


Frank,

After looking at the code again I see that each Set of info is named 
differently 1_ and 2_... It seems then that I would need to keep 
another array of those keys and which button number they apply to.

Is there another way to do that? Because in an item del situation I 
would refer to item 1 every time regardless of what was in it. instead 
using key(1_ddd) and key(2_ddd) etc all for item 1's which are the main 
names of each set of items. I can see how the repeats would work with 
building the 1&"_ddd" etc. But is there another way to do it with 
arrays?

Thanks

Tom

On Feb 24, 2004, at 5:50 AM, Frank Leahy wrote:

>
> On Tuesday, February 24, 2004, at 05:52  AM, 
> use-revolution-request at lists.runrev.com wrote:
>
>> I am starting a new project and have to decide the best way to store a
>> lot of info for my button states and actions.
>> right now I need to decide which is the best way to proceed???
>>
>>
>> My Decision is between arrays (which I am new to understanding), 
>> Custom
>> Properties (which seem complicated for this) and Simple storage
>> containers from delimited text files (which I am used to). Any Help
>> deciding??????
>>
>
> I have a similar situation with the photo album product I've written 
> -- potentially hundreds or thousands of photos all with title, 
> description, size, etc. (12 fields in all), as well as a button 
> ("include").  I store the data in a text file (on disk) that looks 
> something like this:
>
> Version:1.0
> accessGroup:[Choose A Group]
> coverPhoto:IMG_2234 foo.jpg
> date:2/23/04
> description:
> ftpServer:frank at 192.168.0.2
> lastModified:1077572867
> lastModifiedFormatted:2/23/04 at 947 PM
> lastUploaded:
> lastUploadedFormatted:Never
> location:/Temporary Items/Test Albums/1-1
> numPhotos:1
> public:true
> showInGallery:true
> title:1-1
> ---
> 1_date:
> 1_description:
> 1_dimensions:650 x 433
> 1_exif:
> 1_file:IMG_2234 foo.jpg
> 1_fileLastModified:1077546932
> 1_geoURL:
> 1_imageLastTouched:1077572769
> 1_include:true
> 1_keywords:
> 1_size:176128
> 1_sizeFormatted:172.0K
> 1_title:Title 1
> ---
> 2_...
> ---
> 3_...
>
>
> At runtime I read that data into an array that has one key for each 
> entry in the data file:
>
> put "[Choose A Group]" into albumData["accessGroup"]
> put "IMG_2234 foo.jpg" into albumData["coverPhoto"]
> ...
> put xxx into albumData["1_date"]
> put xxx into albumData["1_description"]
> ...
> put xxx into albumData["2_date"]
> put xxx into albumData[2_description"]
> ...
>
> I find that reading and writing the arrays is simple and plenty fast 
> enough even with thousands of photos.
>
> And arrays are a great thing to use at runtime.  Notice that I've 
> named the keys in a way that makes it trivial to get or set any data I 
> need directly.  If I need the title for photo 999, then it's as easy 
> as referencing albumData["999_title"].  And if I needed the titles for 
> photos 100 to 199, it's as easy as:
>
> repeat with i = 100 to 199
>    get albumData[i & "_title"]
>    ...do something with it...
> end repeat
>
> Hope this helps.
>
> -- Frank
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>

Thomas J. McGrath III
SCS
1000 Killarney Dr.
Pittsburgh, PA 15234
412-885-8541



More information about the use-livecode mailing list