what am I doing wrong?

This code never gets the data out of the table view. I am just trying to learn how to get some data out of a table view once it is populated from a MySQL DB. I am getting the data in there ok, but can’t get it out.

This is inside the on clicked theObject section. Basically I have a button that fires this code and then I try to display the_data in a dialog box.

try
tell window “main”
set the_data to (contents of data cell 1 of data row (selected row of table view “data” of scroll view “data”) of data source of table view “data” of scroll view “data”) as string
end tell
on error
set the_data to “”
end try

What’s the error? Instead of just trapping it, trap it and log it:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Sorry it took so long to reply back. I only get to work on this at night. The error is
NSReceiverEvaluationScriptError: 3

I will do some searching on this error to try to figure out what it means.

Thanks in advance for your help.

Are you sure both the table and its containing scroll view are named data and not just one or the other. Try referring to the table by its index instead of name to see if it helps. Also try telling the data source to return the value and, finally, use some parentheses before trying to coerce the value received (and you should probably use Unicode text instead of string for the coercion):

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]