On Tuesday, February 24, 2004, at 05:52 AM, [EMAIL PROTECTED] 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:[EMAIL PROTECTED]
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
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to