Solved

Passing parameters to DevExpress with Reportingservice


Userlevel 3
Badge +11

I am trying to pass a variable to a DevExpress report using the Reportingservice. When I call the report directly, passing the parameter directly as a Report parameter, it works fine. When I am trtying to pass it with help of the rapport_params it fails somehow.  In the rapport_params I inserted the following values:

id    149530
report_id    115036
parmtr_id    order_nr
parmtr_value    1035939
 

Inside the DevExpress report I have defined the variable:

 

 

When I use a value in the preview it also works fine, so I guess the problem is in passing the value from the Reportingservice to the report? Does anyone have any experience with this?

 

icon

Best answer by Tim Waalewijn 11 August 2021, 18:29

View original

12 replies

Userlevel 7
Badge +23

Hi Hugo, 

Personally I have never worked with the Reporting Service so my suggestions are based of the docs and expectations.

I think if the rpt_get_parmtrs function returns all the needed parameters, it will do the trick. Which input parameters does your Report work with? If that is ID, the Report_id and the Order_no for example, I think you would have to return both in the rpt_get_parmtrs function.

parmtr_id parmtr_value
ID 149530
report_id 115036
order_no 1035939

 

I hope that would do the trick. Since the introduction of System Flows it is now possible to send Reports by a System Flow (A Process flow executed by the System without user interaction). You can take a look at my example.

Userlevel 3
Badge +11

Hi Mark,

Thanks for your reply. The report only uses the parameter order_nr, and it is correctly returned by the get_rpt_params:

 

 

We have been working with the Reportingservice / Crystal Reports combination for a long time now, and that works fine. I copied the way this works so I suspect the trouble is somewhere in the DevExpress report. I will see if I can find a tip in the video tutorials of DevExpress. I am open to new suggestions of course.

 

Edit: within the DevExpress report I have a result when the input of the order_nr is done in the preview: 

 

 

So, the remaining question is: how does the report parameter order_nr receive its value from the Reportingservice? Do I have to change the parameter settings within the report, in the Properties below? I have already tried different Datatypes (decimal, string with a conversion to decimal etc.). Nothing seems to work. If someone can explain how the parameter value is transferred to DevExpress it would be a great help.

 

 

Userlevel 7
Badge +23

Hi Hugo,

I get the feeling the Report is trying to use rpt_get_parmtrs as a Data source, but I don't think you'll have to do that. The Reporting service should execute the rpt_get_parmtrs function to obtain the parameter and their values, then generate the report with them (all automatically). The Report only needs the table(s)/view(s) that contain the data you would like to show in the Report. It is (most likely) needed to name all parameters in DevExpress but the function doesn’t have to be called.

Here's my Report example:

Report

I only use a table as my Data source and have one named parameter 'shop_order_id’. I do think this is enough to have.

Could that be the case?

Userlevel 3
Badge +11

I am not calling the rpt_get_prmts, that was only to show you that the code was ok and that I have the parameter value at hand. It just won't load into the report.

 

I do use a subroutine / stored procedure to generate the data, but that should not be a problem (and like I edited in my previous post, from within the report itselves it works fine. The only think I don't understand is how to fill the order_nr parameter within the report with the value provided. 

Userlevel 7
Badge +23

Hi Hugo, I think it's more handy if one of our Service & Care team members look at this problem together with you. They can help you further with this. Could you create a TCP ticket for this?

Userlevel 3
Badge +11

Hi Mark,

 

I already did and they are looking into it. I thought it would be best to keep the topic open and respond with the final solution they come up with.

Userlevel 1
Badge +3

Hi

It looks like we have the same issue, so if there's a a solution, please update this call

 

Thanks

Userlevel 2
Badge

Hey everyone,

Just letting you know we've confirmed this issue happened when using a stored procedure as the data source for the report.

Updating the DevExpress libraries seemed to fix it on our end but in doing so we had to update the .NET Framework version requirements to a version higher than 4.5.

In the end we determined the best choice would be to update all the way to the last version of .NET Framework 4.x which is 4.8.

Doing so also caused a bunch of other cascading work that needed to be done of which the TLDR; version is:

  • Updated to .NET Framework 4.8.
  • Installer project refused to work after the update so that is gone now.
  • Instead of a ReportingConsole.exe and ReportingService.exe only ReportingService.exe is left.
  • To run ReportingService.exe as a Windows service one must now use sc.exe.
  • NLog had to be replaced with another logging library.
  • All settings, including logging, are now contained in an appsettings file similar to the one that Indicium uses.

We are still working on updating https://docs.thinkwisesoftware.com/docs/kb/report_service.html with the changes between version 5 and 3.x/4.x but version 5 can already be downloaded from TCP.

If you want to try updating on your own right away I'd recommend taking the following basic steps:

  1. Backup any ReportingConsole.exe.config/ReportingService.exe.config files you might have.
  2. Install .NET Framework 4.8 if you haven't already got that on the server.
  3. Stop the Windows service if you've installed the previous versions using the installer.
  4. Download version 5.0.0 from TCP and extract it to a new directory.
  5. Copy over settings from your ReportingConsole.exe.config/ReporingService.exe.config backup to the appsettings.json file. (Keep in mind that JSON has different escaping rules that XML so for example a connection string with "Data Source=server\instance;" needs to be escaped like this "Data Source=server\\instance;")
  6. Run ReportingService.exe to see if it works.
  7. If so, de-install the previous Thinkwise Reporting Service if you used the installer.
  8. Use sc.exe from cmd/powershell to create the Windows service manually.

An example for step 8 would be:

sc.exe create ReportingService-V5 binpath="C:\Thinkwise\ReportingService\ReportingService.exe --runas-windows-service" obj="somedomain\someuser" password="somepassword" start=auto

sc.exe start ReportingService-V5

I'll update this post once the documentation has been updated.

 

Edit: The documentation page has been updated. Please take a look at https://docs.thinkwisesoftware.com/docs/kb/report_service.html#upgrading-from-v4-or-v3-to-v5 and the other V5 sections if you are having trouble updating.

Userlevel 3
Badge +11

Hi Tim,

First: thanks.

 

Since we are moving the application and Reporting Service to a new server with SQL Server 2019 I installed the new Reportingservice, started the .exe and an error log was created basically saying I forgot to insert the proper database connection . So i inserted the connection data and restarted the .exe. Nothing happened. I can see no program running or log created. Does that mean everything is ok and I can install this as a service or is something wrong?

Userlevel 2
Badge

Hey Hugo,

 

Assuming you didn’t change anything to the logging section inside the appsettings.json file you should have seen confirmation messages being logged that the database is being polled.

E.g. something similar to the image below:

You’re saying that nothing happened after you restarted the executable.

Does that also mean the command line window does not stay open like in the example above?

If so try starting it from an opened cmd or powershell prompt and see if the program exits immediately with an error.

If nothing shows up there might be an issue with the settings in the configuration file, possibly/probably somewhere in the Logging section.

Userlevel 3
Badge +11

Hi Tim,

 

There was indeed something wrong with the connection string. It works now. I will update as soon as I can test passing the parameters.

Userlevel 3
Badge +11

I tested the devx report together with the new Reportingservice: it works fine! Thanks for the good work.

Reply