Record rust...

It’s been a long time since I’ve dealt with records and can’t figure out the best way to doing the following:

I need to create a list of records. There will be 32 records in the list and each record will have 21 property/value pairs. The data is coming from a text file. Each paragraph in the text file will correspond to one of the property/value pairs. The text file contains only values and the order remains constant throughout the file. (i.e. for each set of 21 paragraphs the data corresponds to the same property/value pairings (I hope that made sense).)

Whats the best way to go about this?

Thanks in advance,
Brad Bumgarner

You could use Database Events, though I cant help much since I have never played with it
http://www.mactech.com/articles/mactech/Vol.22/22.02/IntrotoDatabaseEvents/index.html

The other answer is Filemaker and use Applescript to create the records and populate the fields

Hi.

Records aren’t ordered, of course, so your script will need to know what place in the order corresponds to which label in the record. Something after the following fashion should do it. Substitute your own labels for the letters of the alphabet I’ve used. The values will all be text, so you’ll have to add any coercions you may need to other types.

set theValues to paragraphs of (read (choose file))

set listOfRecords to {}
repeat with i from 1 to (count theValues) by 21
	set {v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21} to items i thru (i + 20) of theValues
	set end of listOfRecords to {a:v1, b:v2, c:v3, d:v4, e:v5, f:v6, g:v7, h:v8, i:v9, j:v10, k:v11, l:v12, m:v13, n:v14, o:v15, p:v16, q:v17, r:v18, s:v19, t:v20, u:v21}
end repeat

Nigel,

That is exactly what I was looking for! I knew it wasn’t hard, I just couldn’t remember how to do it. :lol: Thanks!

Brad Bumgarner

I also suggest Database Events. Been using it for almost 3 years now and it’s been very robust and reliable. Fast access (wasn’t the case with 10.4), easy to use, supports data sorting (ie get name of every record where value of field “language” is not “english”). One of my databases has 1100 records and each of these records have 12 fields and it never failed on me. http://www.mactech.com/articles/mactech/Vol.22/22.02/IntrotoDatabaseEvents/index.html

Thank you both for the Database Events suggestion. I will be looking into that especially since my 21 key:value pairs have grown into 66 key:value pairs! :o

Thanks again,
Brad