Parsing CSV File Via Array - Part I

JOHN PATTEN johnpatten at me.com
Sun Feb 9 11:35:37 EST 2014


Thanks Stephen & Roger…

I’m looking at the tutorial here: http://lessons.runrev.com/s/lessons/m/4071/l/11494-how-do-i-sort-an-array 

But I’m not getting my head around creating a index in order to keep the order of my elements straight. In my script, I thought I was creating an index out of the array? 
…
repeat with y = 1 to the number of items of it ## row spreadsheet data from Google Form
     put item y of it into counterArray[item y of it][y]
…

I see how I can replace my comma deliminated data with tab delimitated data thanks to Richard’s article Roger shared. It looks like LiveCode automagically orders the elements of the array it creates alphabetically? Is that correct? I’m guessing that is why my data is out of order?

Thanks for the suggestions, but still not quite there yet :)




On Feb 9, 2014, at 8:02 AM, Roger Eller <roger.e.eller at sealedair.com> wrote:

> I have used the csv function in Richard Gaskin's article, "CSV must die".
> It works great on Google form data.
> 
> http://www.fourthworld.com/embassy/articles/csv-must-die.html
> 
> ~Roger
> On Feb 9, 2014 12:12 AM, "JOHN PATTEN" <johnpatten at me.com> wrote:
> 
>> Hi All,
>> I'm trying to parse a Google Form csv data file. Each row in csv
>> represents one completed form entry by a user. The Google Form (survey)
>> allows for specific drop down selections. Here's some sample form csv data:
>> 
>> End,End,End,Middle,
>> Just right,Too loud,Too loud,Just right,
>> No,Yes,No,No,
>> 
>> I'm trying to use an array to pull out each item and the item counts. This
>> is what I would like have reported out:
>> 
>> End,3
>> Middle,1
>> Just right,2
>> Too loud,2
>> No,3
>> Yes,1
>> 
>> Myscript is working, but because I call the same array each time I loop
>> through my reported out data is out of order. It looks like:
>> 
>> Yes,1
>> Just right,2
>> No,3
>> Too loud,2
>> Middle,1
>> End,3
>> 
>> (Msg end of Part I)
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list