{please suggest if my data format is wrong, or the best way to achieve my goal}
My example code:
put file"~/Desktop/test" into list
repeat with each student in list
put student
end repeat
Result from this code: showing all my data along with property, I understand why it is showing all my code. I have tried few different ways but with no success
Question:
How do I retrieve my desire data using property feature
Since we are reading those by line (rather than by each comma separated value) we want to use the phrase “each line of” in the repeat statement. That will put each line into a temporary variable called it. In order to evaluate that string into a SenseTalk property list we use the value() function.
Now we have a full property list that we can use to query it’s keys and values the way you would like to.
put file "~/Desktop/test" into list
repeat with each line of list
put value(it) into student
put student's name
put values(student) -- print all values
end repeat
In this case my data have to associate with property and that is so much redundent property data in one place. At least I have learned, how to deal with properties.
could you please present me another example where my data doesn’t associate with property then and I could use the data in forms?
If you don’t want to have to specify the property name on each line in your data file, you can make a simpler file with values separated by commas or other separator:
repeat with each line of file "~/Desktop/test"
put it split by "," into student's (name,email,code)
put student's name
put values(student) -- print all values
end repeat