Hi,
I’ve created a little app. It shows one window (main) with a tab view inside with 4 tab view items (protocol, report1, report2, report3). After launching the app starts a settings panel. There you can check/ uncheck the 3 reports. With a click to a “Create Reports”-button the program retrieves data from a mysql-database and inputs these data into the report table views.
on panel ended theObject with result withResult
tell window "settingspanel"
set report1 to contents of button "report1"
set report2 to contents of button "report2"
set report3 to contents of button "report3"
end tell
end panel ended
on clicked theObject
if title of theObject is "Create Reports" then
CreateReports()
end if
end clicked
on CreateReports()
try
--report1
if report1 then
set SQLQueryFile to POSIX path of (path to resource "report1.sql") as string
set mycontent to mySQLQuery(SQLQueryFile)
tell table view "table_report1" of scroll view "scrollview_report1" of tab view item "tab_report1" of tab view "tabview" of window "main"
set content to mycontent
end tell
end if
--report2
if report2 then
set SQLQueryFile to POSIX path of (path to resource "report2.sql") as string
set mycontent to mySQLQuery(SQLQueryFile)
tell table view "table_report2" of scroll view "scrollview_report2" of tab view item "tab_report2" of tab view "tabview" of window "main"
set content to mycontent
end tell
end if
--report3
if report3 then
set SQLQueryFile to POSIX path of (path to resource "report3.sql") as string
set mycontent to mySQLQuery(SQLQueryFile)
tell table view "table_report3" of scroll view "scrollview_report3" of tab view item "tab_report3" of tab view "tabview" of window "main"
set content to mycontent
end tell
end if
--errorhandling
on error errmsg number errnum
tell text view "protocol" of scroll view "scrollview_protocol" of tab view item "tab_protocol" of tab view "tabview" of window "main"
set contents to "Fehler: " & errmsg & " Fehlernr.: " & errnum
end tell
tell tab view "tabview" of window "main" to set current tab view item to tab view item "tab_protocol"
return
end try
end CreateReports()
on mySQLQuery(SQLQueryFile)
--parameter
set sqlhostaddress to "192.168.0.99" as string
set sqluser to "root" as string
set sqlpwd to "password" as string
--command
set exec to "/usr/local/mysql/bin/mysql --host=" & sqlhostaddress & " --user=" & sqluser & " --password=" & sqlpwd & " < " & quoted form of SQLQueryFile as string
--execute
set sqloutput to do shell script exec
.
.
.
--(some additional handlers for converting the output to a list with separated paragraphs)
.
.
.
return sqloutput
end mySQLQuery
That works fine, but only for 1 report at the same time! If I choose 2 or 3 reports (inside the setting panel at the same time) only the first report is created, all other tabs remains empty. This runs without error-message, the result from the mySQLQuery-Handler (for the 2nd or 3rd report) is “” (empty). I dont know why.
There are no more than 50 rows (by 8 columns) inside one table view.
How can I debug or solve this problem? Any ideas?
Rebewslin