From 2e065bdcc90efdac5d89bae32be2e4bdaf8b48c6 Mon Sep 17 00:00:00 2001 From: KB Bot Date: Wed, 16 Apr 2025 13:54:52 +0000 Subject: [PATCH 1/3] Added new kb article how-to-display-ratings-stars-telerik-reporting --- ...display-ratings-stars-telerik-reporting.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 knowledge-base/how-to-display-ratings-stars-telerik-reporting.md diff --git a/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md b/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md new file mode 100644 index 000000000..1740e3983 --- /dev/null +++ b/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md @@ -0,0 +1,67 @@ +--- +title: Displaying Ratings with Stars in Telerik Report Designer Using JSON Data +description: Learn how to visually represent ratings by stars in Telerik Reporting using data from a JSON data source. +type: how-to +page_title: How to Show Ratings by Stars in Reports with Telerik Reporting +slug: how-to-display-ratings-stars-telerik-reporting +tags: reporting, telerik, json, data source, conditional formatting, shape, list, parameters +res_type: kb +ticketid: 1684841 +--- + +## Environment + + + + + + + + + + + + +
ProductProgress® Telerik® Reporting
Version18.2.24.806
+ +## Description + +The requirement is to display ratings in a Telerik Report using stars, based on data sourced from JSON. The goal is to visually represent ratings such as 3 out of 5 stars, where the number of stars is determined by the data. This knowledge base article also answers the following questions: +- How to use JSON data to display ratings in a report? +- How to use shapes for visual representation in Telerik Reporting? +- How to create and use report parameters in Telerik Reporting? + +## Solution + +To display ratings by stars using a JSON data source in Telerik Reporting, follow these steps: + +1. **Prepare the JSON Data Source**: Use the following JSON structure as the data source for the report: + + ```json + [ + { "product": "Product A", "rating": 4 }, + { "product": "Product B", "rating": 5 }, + { "product": "Product C", "rating": 3 } + ] + ``` + +2. **Create Report Parameters**: Define three report parameters: `MinRating`, `MaxRating`, and `RatingDataPoints`. + - `MinRating` (integer) and `MaxRating` (integer) determine the range of the ratings. For a 5-star rating system, set `MinRating` to 0 and `MaxRating` to 4. + - `RatingDataPoints` uses the expression `= Space(CInt(Parameters.MaxRating.Value))` to generate a string with spaces equal to the maximum rating, which will later be split into individual elements for each star. + +3. **Add a List to the Detail Section**: Insert a [List](https://docs.telerik.com/reporting/report-items/table-crosstab-list/template-items#list) in the detail section of the report and bind it with the expression `= Split(" ", Parameters.RatingDataPoints.Value)`. + +4. **Insert a Star Shape**: Within the list, add a [Shape](https://docs.telerik.com/reporting/report-items/shape), and set its `ShapeType` property to a star. + +5. **Apply Conditional Formatting**: To visually represent the actual ratings, apply conditional formatting to the star shapes. This step involves comparing each item's rating against the row number to determine whether the star should be filled or not. + +6. **Utilize Functions**: The solution makes use of several Telerik Reporting functions, including `Space()`, `CInt()`, and `Split()`, for manipulating data and bindings. More about these functions can be found in the [Telerik Reporting Functions Reference](https://docs.telerik.com/reporting/designing-reports/connecting-to-data/expressions/expressions-reference). + +By following these steps, you create a visual representation of ratings using stars based on JSON data in Telerik Reporting. This approach can be customized to suit different rating scales and visual preferences. + +## See Also + +- [Telerik Reporting Expressions Reference](https://docs.telerik.com/reporting/designing-reports/connecting-to-data/expressions/expressions-reference) +- [Conditional Formatting in Telerik Reporting](https://docs.telerik.com/reporting/styling/styling-reports/conditional-formatting) +- [List Item Documentation](https://docs.telerik.com/reporting/report-items/table-crosstab-list/template-items#list) +- [Shape Item Documentation](https://docs.telerik.com/reporting/report-items/shape) From 19b7051b3bf746468ed1553a0b635051b038a07c Mon Sep 17 00:00:00 2001 From: IvetNikolova <118352332+IvetNikolova@users.noreply.github.com> Date: Thu, 17 Apr 2025 11:11:58 +0300 Subject: [PATCH 2/3] Update how-to-display-ratings-stars-telerik-reporting.md --- ...display-ratings-stars-telerik-reporting.md | 50 +++++++++---------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md b/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md index 1740e3983..a66c1635d 100644 --- a/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md +++ b/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md @@ -2,8 +2,8 @@ title: Displaying Ratings with Stars in Telerik Report Designer Using JSON Data description: Learn how to visually represent ratings by stars in Telerik Reporting using data from a JSON data source. type: how-to -page_title: How to Show Ratings by Stars in Reports with Telerik Reporting -slug: how-to-display-ratings-stars-telerik-reporting +page_title: How to Show Ratings by Stars in Reports +slug: how-to-display-ratings-stars tags: reporting, telerik, json, data source, conditional formatting, shape, list, parameters res_type: kb ticketid: 1684841 @@ -12,30 +12,29 @@ ticketid: 1684841 ## Environment - - - - - - - - - - + + + + + + + + + +
ProductProgress® Telerik® Reporting
Version18.2.24.806
ProductProgress® Telerik® Reporting
Version18.2.24.806
## Description -The requirement is to display ratings in a Telerik Report using stars, based on data sourced from JSON. The goal is to visually represent ratings such as 3 out of 5 stars, where the number of stars is determined by the data. This knowledge base article also answers the following questions: -- How to use JSON data to display ratings in a report? -- How to use shapes for visual representation in Telerik Reporting? -- How to create and use report parameters in Telerik Reporting? +The requirement is to display ratings in a Telerik Report using stars, based on data sourced from JSON. The goal is to visually represent ratings between 1 and 5 stars, where the number of stars is determined by the data. This knowledge base article also answers the following questions: +* How to use JSON data to display ratings in a report? +* How to use shapes for visual representation in Telerik Reporting? ## Solution To display ratings by stars using a JSON data source in Telerik Reporting, follow these steps: -1. **Prepare the JSON Data Source**: Use the following JSON structure as the data source for the report: +1. **Prepare the JSON Data Source**: Use the following sample JSON structure as the data source for the report: ```json [ @@ -46,22 +45,19 @@ To display ratings by stars using a JSON data source in Telerik Reporting, follo ``` 2. **Create Report Parameters**: Define three report parameters: `MinRating`, `MaxRating`, and `RatingDataPoints`. - - `MinRating` (integer) and `MaxRating` (integer) determine the range of the ratings. For a 5-star rating system, set `MinRating` to 0 and `MaxRating` to 4. - - `RatingDataPoints` uses the expression `= Space(CInt(Parameters.MaxRating.Value))` to generate a string with spaces equal to the maximum rating, which will later be split into individual elements for each star. + * `MinRating` (integer) and `MaxRating` (integer) determine the range of the ratings. For a 5-star rating system, set `MinRating` to 0 and `MaxRating` to 4. + * `RatingDataPoints` uses the expression `= Space(CInt(Parameters.MaxRating.Value))` to generate a string with spaces equal to the maximum rating, which will later be split into individual elements for each star. -3. **Add a List to the Detail Section**: Insert a [List](https://docs.telerik.com/reporting/report-items/table-crosstab-list/template-items#list) in the detail section of the report and bind it with the expression `= Split(" ", Parameters.RatingDataPoints.Value)`. +3. **Add a List to the Detail Section**: Insert a [List]({%slug table_template_items%}) in the detail section of the report and bind it with the expression `= Split(" ", Parameters.RatingDataPoints.Value)`. -4. **Insert a Star Shape**: Within the list, add a [Shape](https://docs.telerik.com/reporting/report-items/shape), and set its `ShapeType` property to a star. +4. **Insert a Star Shape**: Within the list, add a [Shape]({%slug telerikreporting/designing-reports/report-structure/shape%}), and set its `ShapeType` property to a star. 5. **Apply Conditional Formatting**: To visually represent the actual ratings, apply conditional formatting to the star shapes. This step involves comparing each item's rating against the row number to determine whether the star should be filled or not. -6. **Utilize Functions**: The solution makes use of several Telerik Reporting functions, including `Space()`, `CInt()`, and `Split()`, for manipulating data and bindings. More about these functions can be found in the [Telerik Reporting Functions Reference](https://docs.telerik.com/reporting/designing-reports/connecting-to-data/expressions/expressions-reference). +6. **Utilize Functions**: The solution makes use of several Telerik Reporting functions, including `Space()`, `CInt()`, and `Split()`, for manipulating data and bindings. More about these functions can be found in the [Telerik Reporting Functions Reference]({%slug telerikreporting/designing-reports/connecting-to-data/expressions/expressions-reference/overview%}). By following these steps, you create a visual representation of ratings using stars based on JSON data in Telerik Reporting. This approach can be customized to suit different rating scales and visual preferences. -## See Also +## Sample Report -- [Telerik Reporting Expressions Reference](https://docs.telerik.com/reporting/designing-reports/connecting-to-data/expressions/expressions-reference) -- [Conditional Formatting in Telerik Reporting](https://docs.telerik.com/reporting/styling/styling-reports/conditional-formatting) -- [List Item Documentation](https://docs.telerik.com/reporting/report-items/table-crosstab-list/template-items#list) -- [Shape Item Documentation](https://docs.telerik.com/reporting/report-items/shape) +* []() From 733ad20da2180a6f53d3311df2d26b4f7f51dcaf Mon Sep 17 00:00:00 2001 From: IvetNikolova <118352332+IvetNikolova@users.noreply.github.com> Date: Thu, 17 Apr 2025 11:37:05 +0300 Subject: [PATCH 3/3] Update how-to-display-ratings-stars-telerik-reporting.md --- .../how-to-display-ratings-stars-telerik-reporting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md b/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md index a66c1635d..bd5323545 100644 --- a/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md +++ b/knowledge-base/how-to-display-ratings-stars-telerik-reporting.md @@ -60,4 +60,4 @@ By following these steps, you create a visual representation of ratings using st ## Sample Report -* []() +* [RatingStars.trdp](https://github.com/telerik/reporting-samples/blob/master/Sample%20Reports/RatingStars/RatingStars.trdp)