Hi *,
I’ve a hard problem with property “sorted data rows” of my data source connected to a table view: it doesn’t work every time… :mad:
Here is my code:
set theDataSource to data source table view "x" of scroll view "x" of window "main"
set sortedDataRows to (sorted data rows of theDataSource) -- <-- this row doesn't work every time
set numSortedRows to (count of sortedDataRows)
P.S. Of course theDataSource’s “sorted” property is set to true and “sort column” set to one of his columns.
At run-time the error message of dialog box says: “AppleScript error: the variable sortedDataRows is not defined (-2753)”
In “build and debug” mode with a breakpoint on the signed row of my code doesnt’ work every time: in “locals” sometime I see
Model: ;ac
AppleScript: 1.4
Browser: Firefox 1.0.4
Operating System: Mac OS X (10.4)
I try your code but the problem remains unsolved.
I try “set sortedDataRows to {}” before
“set sortedDataRows to sorted data rows of theDataSource”,
but the result is the same (the variable “sortedDataRows” is not defined)
y2k wrote:
Same problem with or without parentheses…
Now, I think that I would have to implement a QuickSort function to do data source sorting by myself…
Thanks for opinions,
sixware
Even though this tread started in 2005 I’ll post this hint for everyone like me, who couldn’t get the ‘set sortedDataRows to (sorted data rows of theDataSource)’ to work properly.
It seems that the ‘sorted data rows of theDataSource’ Statement only returns a result if the ‘theDataSource’ IS ACTUALLY sorted.
Otherwise the variable ‘sortedDataRows’ will not be defined.
So you 'll have to test the sort condition of ‘theDataSource’ first:
if sorted of theDataSource = true then
set sortedDataRows to (sorted data rows) of theDataSource
else
set sortedDataRows to data rows of theDataSource
end if