How would I convert my database into the list format so I can easily populate my Studio table? The first 6 records of my 7000-record database file looks like this:
AFL AFL 7 AFL 44
AMTRAK AMTRAK 7
Abel act 272 A 44
Alabama Alabama 235 A 44
Alaska Alaska 236 A 44
America America 191 er 201
AS Studio provides a simple method for populating tables:
“set content of tableView to {{“Red”, “Green”, “Blue”}, {“Black”, “White”, “Gray”}} --This would produce a table view with two rows and three columns.”
I’ve already tried using an applescript loop subroutine to process data read from a file by formating each line read, however this takes too long. My intuition is to employ a clever UNIX AWK function do the translation. While it’s easy enough to use awk ‘{print “{"”$1"", "“$2"", "”$3"", "“$4"", "”$5"", "“$6"", "”$7""}"}’ to format data record to produce the following outcome:
{“AFL”,“AFL”,“7”,“AFL”,“44”}
{“AMTRAK”,“AMTRAK”,“7”,“”,“”}
{“Abel”,“act”,“272”,“A”,“44”}
I’m stumped on how to handle the database end-of-lines to generate the desired form:
{{“AFL”,“AFL”,“7”,“AFL”,“44”}, {“AMTRAK”,“AMTRAK”,“7”,“”,“”}, {“Abel”,“act”,“272”,“A”,“44”}} …
I am guessing that the solution to my problem is fairly well known to those who work with Aapplescript Studio. I would appreciate any advice on this.