Sort a range of rows in Numbers.
Sort a range of rows in Numbers.
- Subject: Sort a range of rows in Numbers.
- From: KOENIG Yvan <email@hidden>
- Date: Sun, 1 Feb 2009 14:56:08 +0100
Hello
The Numbers dictionary states:
sort v : Sort the rows of the table.
sort table
by column : The column to sort by.
[direction ascending/descending]
[in rows range] : Limit the sort to the specified rows.
Alas,
if I run this script:
--[SCRIPT]
property myDoc : "testScript.numbers"
property mySheet : "Feuille 3"
property myTable : "Tableau 1"
property myColumn : 3
property knownSyntax : true
tell application "Numbers09"
if (name of documents) does not contain myDoc then error "The
document " & myDoc & " is not open !"
tell document myDoc
if not (exists sheet mySheet) then error "There is no sheet " &
mySheet & " in document " & myDoc & " !"
tell sheet mySheet
if not (exists table myTable) then error "There is no table " &
myTable & " in sheet " & mySheet & " of document " & myDoc & " !"
tell table myTable
set nbRows to row count
set myRange to {10, 30}
if knownSyntax then
sort by column myColumn direction ascending in rows myRange
else
sort by column myColumn direction ascending
end if
end tell -- table
end tell -- sheet
end tell -- document
end tell -- application
--[/SCRIPT]
I get the log report:
tell application "Numbers"
get name of every document
{"testScript.numbers"}
exists sheet "Feuille 3" of document "testScript.numbers"
true
exists table "Tableau 1" of sheet "Feuille 3" of document
"testScript.numbers"
true
get row count of table "Tableau 1" of sheet "Feuille 3" of document
"testScript.numbers"
44
sort table "Tableau 1" of sheet "Feuille 3" of document
"testScript.numbers" by column 3 of table "Tableau 1" of sheet
"Feuille 3" of document "testScript.numbers" direction ascending in
rows "10:44"
"Erreur dans Numbers : Intervalle de tri incorrect."
I tried to define myRange with
{10, 14}
{10,11,12, 13, 14}
but I got the same error
I tried with
10 to 44
10 thru 44
but both are rejected on compile time.
Maybe some of you may have a better idea allowing me to really work
with knownSyntax set to true.
Yvan KOENIG (from FRANCE dimanche 1 février 2009 14:55:59)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden