Author: Colm Carew
– This assumes that you have some MySQL and Groovy/Java knowledge.
Always remember to use Errigal QA first (qadb1.err) as the datasource and connect as a reader account. If you have any questions feel free to ask a team member.
SELECT
t.id ticket_id, st.status ticket_status
FROM
ticket t
JOIN
ticket_status st ON st.id = t.current_status_id
ORDER BY t.id desc
LIMIT 100;
def runScript() {
def db = SqlConnectionManager.instance.retrieveSql('ticketer')
def table = new ReportTable(title: "Example Report")
String exampleQuery = """
SELECT
t.id ticket_id, st.status ticket_status
FROM
ticket t
JOIN
ticket_status st ON st.id = t.current_status_id
ORDER BY t.id desc
LIMIT 100;
"""
def exampleResult = db.rows(exampleQuery)
exampleResult.each { resultRow ->
//If you want everything from your query
//resultRow.row_color = ''
//table.addData(resultRow)
//If you want to specify which columns + which order they should be in
table.addData([
ticketId : resultRow.ticket_id,
ticketStatus: resultRow.ticket_status
])
}
[table: table]
}
**Note when moving between the Report Builder and the Reporting Manager the code in-between :
import com.osssoftware.reporting.*
and
def response = new ReportExecutorResponse()
in the Reporting Manager report is the same as the code between
def runScript() {
and
[chart: chart, table: table] }
in the Report Builder
The errigal-amcharts plugin used for the charts creation lacks the ability of modifying many chart-related settings (e.g. max and min Y axis line values).
Should you need to modify the chart settings or values in non-plugin-intended ways, you may do so manually. In the chart generation Groovy script, retrieve the chart settings after building the chart (chart.retrieveChartSettings(true)), modify the XML file-representing String manually (you can find all the required information on doing that here), and then set the ReportExecutorResponse chartSettings as the modified String.