Using Telerik Report Parameters
Fast-Weigh GraphQL & REST APIs
Required Parameters
When building your reports within Telerik, you have the ability to link your GraphQL Where Clause directly to dynamic parameters within Telerik to filter your data.
- Ensure that you have your Where Clause set up within your GraphQL Query.
- When you copy your query Body over from Insomnia, it should auto-generate Telerik parameter connectors in your variables.
- Click Next to go to the Configure Request Parameters page. Here, you will see your auto-generated parameters.
- Make sure the Type is set to Inline for any Parameters that are passed to your GraphQL Body.
- Enter the values you want to use for the data preview in the Design-Time Value
- Set up the parameterized value in Value by selecting the drop-down > New Report Parameter (if you have pre-setup your parameter, just select it from the list).
Setup the Telerik Parameter in the Report Parameter Editor pop-up
- Some GraphQL Where clause formats will need to add extra formatting in your Value
- Strings: Make sure your body does have quotes around the @variable in the Body.
- Integers: Make sure your body does not have quotes around the @variable in the Body.
Dates: Make sure your body does have quotes around the @variable in the Body.
- You will also need to add the following formatting to the Value expression to ensure that the date is in the correct Year-Month-Day format:
= Format("{0:yyyy-MM-dd}", Parameters.NAME.Value )
String Arrays: Make sure your body does not have quotes and does have brackets around the @variable in the Body.
- You will also need to add the following formatting to the Value expression to ensure that each value selected is wrapped in quotes and separated by commas:
='"' + Join('","', Parameters.NAME.Value ) + '"'
Integer Arrays: Make sure your body does not have quotes and does have brackets around the @variable in the Body.
- You will also need to add the following formatting to the Value expression to ensure that each value selected is separated by commas:
=Join(',', Parameters.NAME.Value )
- Click Next to preview your data using the Design-Time Value, then click Finish.
- Navigate to the Home tab on the top of the report and click Preview to test your parameters.
Optional Parameters
In addition to Required Parameters that directly filter what is returned from your Data Source, you can also use Telerik by itself to create optional parameters and filters.
- Set up the parameter by right-clicking the white space on the report and then clicking Report Parameters...
Add in a new Parameter in the Report Parameter Editor pop-up
- Click OK to close the pop-up.
- Right-click the report white space again and this time select Filters...
Note: you can also use Filters for simple data filters like filtering out all voided tickets. Add a new Filter that you will map to your new Report Parameter
- Since we want this parameter to pull in everything when blank or filter to one customer when filled out, we will need to add in more to the expression than a simple filter.
- Under the Expression side of the filter editor, click on the drop-down arrow and select <Expression>
- Click in the text box after the equals sign
- Navigate to Functions > Logical and double click IIf to add it into the text box above. (You can also manually type this instead of pulling it in from Functions)
Begin the conditional IIf statement with a check to see if the parameter is blank.
- Add in the parameter value by Navigating to Report Parameters > click the + by the parameter name > double click Value
Note: Here, we are adding Parameters.CustomerID.Value - In the text box, click between the end of the Value and the parenthesis and add in an equal sign and an empty quote:
= ""
- This completes the check to see if the parameter is blank.
Click in the text box after the empty quotes and add a comma to begin the truePart of the IIf statement.
- Note: Here, we want nothing to happen if the expression is true (the parameter is blank).
- Add in another empty quote:
""
- This completes the truePart of the IIf statement.
After the truePart, add another comma to begin the falsePart.
- Navigate to Fields and double-click on the field you want to populate if the parameter is not blank (what it will be matching).
Note: Here, we want the Customer ID to populate if the expression is false (the parameter is not blank).
- This completes the falsePart of the IIf statement.
- Click OK to close the Expression Editor.
- Under the Value side of the filter editor, click on the drop-down arrow and select the Parameter.
- This completes your entire optional filter. Go ahead and close the Filter Editor.
Navigate to the Home tab on the top of the Report Designer and click Preview to test out the report.
- You should be able to leave your new parameter blank (you may have to click inside of the field and then click out in the report designer so it registers and blank) or type in a value to filter the report to that single value
Related Articles
Connecting GraphQL to Telerik Report Designer
Fast-Weigh GraphQL & REST APIs To add the API module to your Fast-Weigh subscription, contact us at 865-219-2980 or support@tacinsight.com. Note: Make sure you are running Telerik Report Designer version 14.0.20.219 or later. Navigate to the Data tab ...
Using Parameters
Fast-Weigh GraphQL & REST APIs To add the API module to your Fast-Weigh subscription, contact us at 865-219-2980 or support@tacinsight.com. Using Parameters Parameters allow you to pass data into your GraphQL statement. Common parameter types Int ...
Telerik Report Formatting
Fast-Weigh GraphQL & REST APIs To add the API module to your Fast-Weigh subscription, contact us at 865-219-2980 or support@tacinsight.com. Here are some additional walkthrough videos on tools you can use within Telerik to Style your reports ...
Helpful Telerik Links
Fast-Weigh GraphQL & REST APIs To add the API module to your Fast-Weigh subscription, contact us at 865-219-2980 or support@tacinsight.com. Telerik Support Page Telerik Designing Reports Knowledge Base Telerik Reporting Forum Getting Started with ...
Handling Nullable Tables in Telerik
Fast-Weigh GraphQL & REST APIs To add the API module to your Fast-Weigh subscription, contact us at 865-219-2980 or support@tacinsight.com. Sometimes, you may have a table linked in your GraphQL query that can be set or completely blank depending on ...