Telerik Standalone - How to Get the Difference Between the Values of Items From Different Data Sources?

1 Answer 53 Views
DataSource Object DataSources Expressions Report Designer (standalone) Report Parameters Table
Malcolm
Top achievements
Rank 1
Malcolm asked on 12 Jun 2023, 11:43 PM

I'm pretty new to Telerik Report Designer, and I could use some help. Let me also preface this by saying, I'm looking for a solution that doesn't require code, and only uses the tools available in Telerik itself (if such a solution even exists).

I'm working on a report to calculate the number of vacant beds in living spaces. To do so, I'm getting the difference between the total number of beds and the number of residents.

The problem is, the data for getting the number of beds and the data for getting the number of residents are in two different Data Sources... so, I can't use an expression to calculate the difference, as I can only use the Data Source that's bound to the report for expressions. I have been able to use tables to display both values, but the fact remains, I can't calculate the difference between them.

I know I can set one of the values as an invisible parameter, but the problem with that is, that value becomes fixed, and is the same for every living space in the report, when I need it to be different for each one.

Does anyone know of a solution to this? Again, one that doesn't require code.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 15 Jun 2023, 12:19 PM

Hi Malcolm,

Thank you for the detailed description of your scenario!

Besides what you have already discovered, using report parameters to hold the values that need to be subtracted, the only other option without writing code would be to combine the data of the two data source components into a single data source. Since using code is undesired, I can see a way for this without code only if you are using the SqlDataSource component so that you can create a query that combines the results of the other two queries - How to Combine the Results of Two Queries in SQL | LearnSQL.com.

If using code was possible as a last resort, you could try to achieve this with a user function that returns the subtracted value. What arguments(if any) would need to be passed to the function depends on how dynamic is your data. I can help further with that if necessary but for now, I recommend looking into the Custom User Functions Explained - Telerik Reporting article to get an idea of what they are and how they work.

If you need further assistance, please send me sample data plus the report and I will see if I can come up with a solution locally with or without code.

Thank you for using Telerik Reporting!

Regards,
Dimitar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
DataSource Object DataSources Expressions Report Designer (standalone) Report Parameters Table
Asked by
Malcolm
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or