This is a migrated thread and some comments may be shown as answers.

How to override Report standard functions in runtime?

2 Answers 32 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tursunkhuja
Top achievements
Rank 2
Veteran
Tursunkhuja asked on 19 Feb 2021, 10:32 AM

In my report I'm using Telerik reporting Now() function. This function returns current datetime value which is fine when I preview the report from Standalone Report Designer. But, when I upload my created report in our app and if I see that report from our app, I don't want to see that Now() function returns current datetime value there. Because, in our app's demo data we use constant(for example: 5/12/2019) as value of Now() function instead of current value.

I want to achieve this goal by using Telerik reporting Now() function without creating another user defined function. I also have CustomReportResolver class which implemented IReportSourceResolver interface. 

Is there any solution to achieve this goal? Any way to do it programmatically, maybe in custom report resolver?

 

Thanks!

 

2 Answers, 1 is accepted

Sort by
0
Tursunkhuja
Top achievements
Rank 2
Veteran
answered on 22 Feb 2021, 06:16 PM
Sure,
I have created the sample invoice report as you can see it from the attached picture (InvoiceReport.png). If you see the picture, I used "Now()" Telerik function that it returns current datetime. But, when I upload this report to our App and when I use it, I want that Now() function not to show current datetime, but instead it should show Fake Demo Date which is in our project (See picture #2 - FakeDate.png). For this purpose I need to override the Telerik Now() function somehow.
0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 23 Feb 2021, 08:10 PM

Hi Tursunhuja,

I would like to apologize for the inconvenience. The previous posts asking for a file to preview made it past our spam filters. I have gone ahead and deleted those posts. 

As for the question, from what I understand, this would be better handled as a Report Parameter and in the Report Design use the Now() function to set its design-time value. Let me provide an example of what that would look like below. 

Report Parameter Design-Time Value

The implementation is done by creating a Date parameter, setting it's Value property to =Now() and then outputting the value in the report. See the following screenshot for a visual reference.

Passing Parameter Values

The next part of the implementation is to pass a value to the parameter of the Report Viewer. We have several articles that illustrate this for our many HTML5 Report Viewers. I ahve listed them below and they depend on which report viewer you are using in your application.

Wrapping Up

Understandably, the above implementation may or may not work for your scenario. If it doesn't, I ask that you provide more information by providing the hosting application, the report viewer and the sample report for review. 

If privacy is a concern, we can convert this to a ticket which will remove it from the public domain. Let me know if that is an option you would like to pursue.

Please let me know if you need any additional information. Thank you for choosing Telerik Reporting.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Tursunkhuja
Top achievements
Rank 2
Veteran
Answers by
Tursunkhuja
Top achievements
Rank 2
Veteran
Eric R | Senior Technical Support Engineer
Telerik team
Share this question
or