To Generate a Report in Specify 7
- Click on ‘Queries’ and click on the ‘pencil’ besides the saved query
- Select ‘Define report based on a query’ for reports and ‘Define label based on a query’ for labels
- Type in your desired report name in the pop up and click on ‘create’
-
Once the name is saved, you will be redirected to the App Resource page. Select ‘Download’ to get a jrxml format of your report query
-
In Jasper Studios, go to ‘file’ select import
-
Under ‘General’ select ‘File systems’ and click on Next
-
Select the folder where your query is located, using the browse function
-
In ‘into folder’ select an existing folder or a new folder to save your new report in
-
Click on the imported query from the Project Explorer tab and edit the report as in Sp iReport.
-
Once the reports are done, go to ‘file’ and click on ‘export’
-
Choose your export destination similar to steps 6 & 7 and click apply
-
Go to app resources in Sp7 and select the report name created in step 3
-
Select ‘Load file’ and choose the exported report from Jasper Studio and Save
To Add Columns
- Click on Properties
- Select the ‘Advanced’ tab
- Change the Column count to the desired number of columns
To Edit Expressions
- Click on Properties
- Select Text Field tab
- Click on yellow pencil icon to edit expression
To Add an Image
- Select Image under Basic Elements
- Drag and drop the image onto the report
- Add this expression:
new java.net.URL(“https://www.specifysoftware.org/wp-content/uploads/2020/02/SCC_logo_homepage.png”)
*replace the url in quotation marks with the url of your image
To Add a Scriptlet
- Click on your report in the outline pane on the left of the page to access report properties
- In the properties tab, set the scriptlet class to edu.ku.brc.specify.config.Scriptlet
Scriptlets in Specify 7
Expression for formatted Latitude/Longitude and direction characters:
To display latitude and longitude in the original format (as they are shown in Specify) and with direction characters (N, E, S, W), you would use the .formatLatLon and .getDirChar Scriptlets. The query fields necessary for these two scriptlets are latitude1, longitude1, and original latitude longitude unit.
((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).formatLatLon($F{Latitude1}, $F{Original_Latitude_Longitude_Unit}, true) + ((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).getDirChar($F{Latitude1}, true) + " " + ((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).formatLatLon($F{Longitude1}, $F{Original_Latitude_Longitude_Unit}, false) + ((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).getDirChar($F{Longitude1}, false)
The above expression displays as:
Truncating lat/long values
($F{Latitude1}==null?“”:((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).formatBigDecimal($F{Latitude1},5)+" “)+($F{Longitude1}==null?”":((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).formatBigDecimal($F{Longitude1}, 5))
To truncate lat/long and get direction characters
($F{Latitude1}==null?“”:((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).formatBigDecimal($F{Latitude1},4)+" "+((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).getDirChar($F{Latitude1}, true))
($F{Longitude1}==null?“”:((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).formatBigDecimal($F{Longitude1},4)+" "+((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).getDirChar($F{Longitude1}, false))
*Note: If you want the lat/long values to print exactly as they are in Specify (ex: decimal degrees), use the lat1text and long1text fields in the Query. This is easier than using the original lat/long scriptlet above, but it doesn’t include a directional character.
Scriptlet for primary collector:
((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).deaggregateFirst($F{1,10,30-collectors.collector.collectors}, ", ")
Scriptlet for secondary collectors:
((edu.ku.brc.specify.config.Scriptlet)$P{REPORT_SCRIPTLET}).deaggregateSecondary($F{1,10,30-collectors.collector.collectors}, ", ")
Nuances of JasperSoft Studio
- It tends to complete expressions for you. For example, if you begin an expression with a bracket, it will close the bracket for you. Same with quotations (“”).
- If you drag a field onto the report, it will automatically add a static text field which acts as a label. You can avoid this by dragging a text field from the Basic Elements tab and editing the expression to add fields to the expression.