Convert Csv To Array

does anyone have any idea how to read a csv file that will look something like this:
type1,content1
type2,content1
type2,content2
type2,content3
type1,content2

the point being that the types may not be in the right order, and then take those types and put all of the same content types into seperate arrays, and then be able to use an if statement that can ask if another (constantly changing) variable is equal to any of the values in that array(which will obviously be in a while statement).
any ideas?

Model: iMac 21.5" 2010
AppleScript: 2.2.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)

You’re not explaining yourself very clearly. Have another try.

i want an applescript that can read comma seperated values from a text file and sort the different types into arrays, the file would look like so:

type,property1,property2
type,property1,property2
type,property1,property2
type,property1,property2
type,property1,property2
type,property1,property2
type,property1,property2

i need it to sort all of the same types into arrays.

If you’re happy to use a third-party helper app, I think this is what you’re after:

--set theData to read file (choose file)
set theData to "type,property1,property2
type,property1,property2
type,property1,property2
type,property1,property2
type,property1,property2
type,property1,property2
type,property1,property2"
tell application id "au.com.myriad-com.ASObjC-Runner" -- ASObjC Runner.app
	set theData to modify string theData so it is listed csv
	set theLists to modify list theData with cols to rows
end tell
--> {{"type", "type", "type", "type", "type", "type", "type"}, {"property1", "property1", "property1", "property1", "property1", "property1", "property1"}, {"property2", "property2", "property2", "property2", "property2", "property2", "property2"}}

You can do it pretty easily in straight AppleScript too, as long as the csv doesn’t contain quoted values.