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

UserFunction not returning anything

4 Answers 112 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 2
Josh asked on 30 Sep 2019, 10:25 PM

Hello,

I have created, deployed, and configured (the app config for) an assembly that contains User Functions. I can see the user Functions in the Report Designer as expected. If I try to use one of the user function methods, I get zero output. I was worried that because the public class and public functions are declared as static that maybe I was trying to do too much (and possibly using too many resources) so I simplified it to the greet method shown in a few examples. All it does is take a string as parameter and format that string with a greeting. Super simple. My copy of that user method doesn't return anything either.

 

Any ideas why my User Functions are returning zero data?

I do have unit tests that prove these functions work as designed.

What kind of limitations, if any, should I be aware of when building and using User Functions?

Are there any resources on building and using User Functions in the Report Designer? Also, is this the correct forum?

 

Thanks for the help and insight.

Josh Blair

HDS Labs, LLC

4 Answers, 1 is accepted

Sort by
0
Josh
Top achievements
Rank 2
answered on 30 Sep 2019, 10:48 PM

Note, I did configure the report designer's app config with the following:

C:\Program Files (x86)\Progress\Telerik Reporting R2 2019\Report Designer\Telerik.ReportDesigner.x86.exe.config

 

<Telerik.Reporting>
    <AssemblyReferences>
      <add name="MyCompany.Reporting.UserFunctions" version="1.0.0.0" />
   </AssemblyReferences>
</Telerik.Reporting>

 

Do I also need to configure the reporting server (engine) with the same type of configuration? If so, please let me know where this is done. This article seems to be saying something like that but I can't tell where this needs to happen:

https://www.telerik.com/support/kb/reporting/report-designer/details/deploying-trdx-(xml-report-definition)-that-uses-external-assembly

 

Thanks again,

 

Josh Blair

HDS Labs, LLC

0
Josh
Top achievements
Rank 2
answered on 01 Oct 2019, 05:10 PM

OK, after some trial and error, I figured out that the custom user function assembly needed to also be configured in the Telerik Reporting Web app by configuring the C:\Program Files (x86)\Progress\Telerik Report Server\Telerik.ReportServer.Web\TelerikReporting.config.

I got this configured and got results from my most basic user function, Greet, borrowed from the samples that I have come across.

If I try my other user functions, I get unexpected errors like:

An error has occurred while processing TextBox 'TextBox4':

The expression contains undefined function call ConvertDate()

Oddly enough, this function is built as a static function that returns a DateTime. I'm unsure how best to troubleshoot or debug this issue. Any guidance is greatly appreciated.

Is there anything that needs to be done to update new versions of this assembly in order for the Telerik Reporting Server and Designer to see the updates?

In the meantime, I will try to add logging to my user functions assembly. Any other guidance is greatly appreciated.

0
Josh
Top achievements
Rank 2
answered on 01 Oct 2019, 06:47 PM

Another issue I am encountering: my User Function assembly project is targeting .Net Standard 2.0 and I have a dependency on Newtonsoft.Json for parsing JSON. The version this user function assembly is referencing is newer than the version that the Telerik Reporting Server web application has in the bin folder. Is there something that I can do to have my assembly use the newer version and not break the Telerik Reporting Server web application?

Telerik Reporting Server (in the bin folder) version: 9.0.1.19813

My custom user function assembly version: 11.0.2.21924

Here is the reference in my custom User Function assembly:

  <ItemGroup>
    <Reference Include="Newtonsoft.Json">
      <HintPath>..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\newtonsoft.json\11.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
    </Reference>
  </ItemGroup>

 

Thanks,

Josh Blair

HDS Labs, LLC

0
Todor
Telerik team
answered on 03 Oct 2019, 03:30 PM

Hello Josh,

If one of the public static methods in the User Functions assembly is discovered correctly I don't see a reason for the others not to be. Is the method ConvertDate() public static? Could you send us the assembly so that we can test it locally? See also User Functions article.

Note that you need to add the reference to the User Functions assembly also in the config file for the Report Server Service Agent configuration file so that the reports to be rendered correctly also for the Scheduled Tasks. This is Telerik.ReportServer.ServiceAgent.exe.config located at [installation folder]\Progress\Telerik Report Server\Services.

If you add tracing in the User Functions, the logs will be recorded if you enable Trace Listener for the Report Server - check Troubleshooting Report Server and Telerik Report Server Service Agent is not running for details.

With each upgrade of the User Functions assembly, you need to deploy the new version to the corresponding Report Server and Standalone Designer folders, and to change the Assembly Reference if modified (e.g. versioning).

For the issue with the Newtonsoft.Json version, you may test to replace the dll that comes with the Report Server with the one you use and add bindingRedirects to the newer version in the configuration files of the Report Server application and the ServiceAgent.

Regards,
Todor
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Josh
Top achievements
Rank 2
Answers by
Josh
Top achievements
Rank 2
Todor
Telerik team
Share this question
or