Add a Data Set
A data set fetches data from the Cityworks database tables to display data in a report. The DataSet panel is where you provide a command type and query string and choose other options for your data set. Common Values can also be used and are generic report fields that can be added to a report.
The steps for adding a data set differ depending on the version you have installed. Select the version you are on below to complete the task:
A dataset fetches data from the data source to display in a report. The DataSet panel is where you provide a command type and query string and choose other options for your dataset. Common Values can also be used and are generic report fields that can be added to a report.
NOTE: If multiple data sets are adding, the report reads them read top to bottom.
- Open the Report Designer.
- Click the Data tab.
- Click Add Data Set.
- Enter the Name of the data set. Data set names cannot have spaces.
- Select Command Type. The default is Text.
- Enter a query to gather the desired fields from the desired database tables. These are the fields that are used to create reports.
TIP: To add an entire table to a report, enter the following in the Query field: Select * from table. See Common Query Examples and Add a Dataset in the Mescius documentation for more a more in-depth explanation of data sets and crafting queries.
- Click Validate.
- Click OK.
BEST PRACTICE: It is best to include only the necessary fields in the query to reduce the load on the application calls to the SQL Server instance. This approach ensures that the application logic iterates through fewer fields, optimizing performance.
The fields appear in the Data Sets panel on the right side. Now these fields can be dragged and dropped in to a report.
A data set fetches data from the data source to display in a report. The DataSet panel is where you provide a command type and query string and choose other options for your data set. Common Values can also be used and are generic report fields that can be added to a report.
NOTE: If multiple data sets are adding, the report reads them read top to bottom.
- Open the Report Designer.
- Click the Data tab.
- Click Add in the Data Sets section.
- Double-click the DefaultDataSet.
It appears under the Data Sets section.
- Click Edit Data Set.
- Edit the Name of the data set. Data set names cannot have spaces.
- Select Command Type. The default is Text.
- Enter a query to gather the desired fields from the desired database tables. These are the fields that are used to create reports.
TIP: To add an entire table to a report, enter the following in the Query field: Select * from table. See Common Query Examples and Add a Dataset in the Mescius documentation for more a more in-depth explanation of data sets and crafting queries.
If a custom data source was added to pull in attachments, enter something similar in the Query field to connect to the files wanted.
TIP: Use an asterisk (*) in a query at the end to pull in all attachments in a folder.
- GIS Thumbnails
- thumbnail:workorder*
- This query fetches all work order related map images.
- thumbnail:workorder[WorkOrderId]<image file name>.png
- This query fetches a specific image from the work order ID entered when the report is viewed.
- thumbnail:case*
- This query fetches all case related map images.
- thumbnail:case[CaseObjectId]<image file name>.png
- This query fetches a specific image from the case ID entered when the report is viewed.
- Attachments
- attachment:workorder/[WorkOrderID]/*
- This query fetches all attachments related to the work order ID entered when the report is viewed.
- attachment:Inspection/[InspectionId]/*
- This query fetches all attachments related to the inspection ID entered when the report is viewed.
- attachment:Request/[RequestId]/*
- This query fetches all attachments related to the service request ID entered when the report is viewed.
- attachment:reldocs/[CA_OBJECT_ID]/*
- This query fetches all attachments related to the case ID entered when the report is viewed.
- attachment:reldocs/[CA_OBJECT_ID]/payments/*
- This query fetches all payment attachments related to the case ID entered when the report is viewed.
- attachment:reldocs/[CA_OBJECT_ID]/tasks/*
- This query fetches all task attachments related to the case ID entered when the report is viewed.
IMPORTANT: To pull in the attachments, the Attachment Root Directory preference in Admin should be edited to include /data/attachments/ in the path. See Configure Domain Preferences in the Admin 3.8 Guide for more information.
IMPORTANT: A parameter must be configured if you are entering the ID of a specific work activity when viewing the report. See Create a Parameter for more information.
To see the full process of configuring attachments for a report, see Configure Attachments for ActiveReports for more information.
- Click Validate.
NOTE: If you are an Oracle client and validate doesn't work, remove the ending semicolon and click Validate again.
- Click OK.
BEST PRACTICE: It is best to include only the necessary fields in the query to reduce the load on the application calls to the SQL Server instance. This approach ensures that the application logic iterates through fewer fields, optimizing performance.
The fields appear in the Data Sets panel on the right side. Now these fields can be dragged and dropped in to a report.