Custom Reporting Data Source (Basic)
- 18 Dec 2024
- 1 Minute to read
- Print
- DarkLight
Custom Reporting Data Source (Basic)
- Updated on 18 Dec 2024
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Overview
Report data sources can be easily created in Decisions by tagging public classes that return an array with an attribute.
SDK examples such as Simple Custom Data Sources are available for download on the Decisions Public GitHub Repository.
Example
This example demonstrates how to create a custom Data source using the SDK.
- Create a new Class Library project.
- Decorate the class with the following attribute. This attribute will automatically register any public method that returns an array as a reporting data source.
[AutoRegisterMethodsOnClassAsReportSources(true, "Custom Data Sources")]
Create a public method in the class that returns the data that should be available for reporting data sources. It must return an array of data that will be used to populate reports. The name of the method will become the name of the data source. The inputs of the method (if any) will become inputs of the data source in the Decisions Report Designer.
- After the method is written, build the project and deploy the code into Decisions.To learn more, see SDK Basics.
- After deploying the code, log into Decisions and create a new Report. The data source is now listed along with other data sources. If the method has input data, set the value of that data by selecting the data source and then entering data in the properties on the right.
{ [AutoResgiterMethodsOnClassAsReportSources(true, "Custom Data Sources")] [Writable] public class SimpleCustomDataSource { public SoftwareItem[] MoreThanTenAvailableLicenses() public IORMEntity[] AccountsContainingSpecificName() { ORM<Account> aORM = new ORM<Account>(); FieldWhereCondition fieldWhereCondition = new FieldWhereCondition("user_identifier", QueryMatchType.Equals, "Jason@decisions.com"); { fieldWhereCondition }; IORMEntity[] results = aORM.Fetch(whereConditions); return results; } } }
Was this article helpful?