Loading reports from Stimulsoft Reports.Server

Stimulsoft Reports.NET discussion
JNieto
Posts: 8
Joined: Wed Mar 23, 2016 9:23 am

Re: Loading reports from Stimulsoft Reports.Server

Post by JNieto »

OK! I will have that into account. Thanks for being so kind!
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Loading reports from Stimulsoft Reports.Server

Post by Andrew »

Hello,

We are glad to help you.

Thank you.
JNieto
Posts: 8
Joined: Wed Mar 23, 2016 9:23 am

Re: Loading reports from Stimulsoft Reports.Server

Post by JNieto »

Hello again! I'm trying to retrieve a report from the server. I have successfully connected to it and logged in using my credential, but I cannot get anything from it.

My report is named "MyReport".

I'm using stiServerConnection.Items.GetByKey("MyReport"), but I this is Exception message I'm getting:
"IsNotCorrect, Arguments: ItemKey"

I tried to get the key of the report using the Share conext menu. It says that the key is "521b1", but using it fails, too.

Could you please tell me how to retrieve a report? The code in the samples seems to be outdated.

My goal is to get a report and save it to PDF.

Big thanks!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Loading reports from Stimulsoft Reports.Server

Post by Alex K. »

Hello,

You can use the developer key from the Tools Tab.
Also, you can use the GetByName method.

Thank you.
Attachments
IMG_31032016_142738.png
IMG_31032016_142738.png (25.62 KiB) Viewed 2089 times
JNieto
Posts: 8
Joined: Wed Mar 23, 2016 9:23 am

Re: Loading reports from Stimulsoft Reports.Server

Post by JNieto »

It works nicely! Thank you, but now I would like to know how to generate a LOCAL PDF file with the contents of the report. Please, notice that my report uses a parameter (named "P_CDPERSONA").

How do I continue once I get the item? My code is this:

var connection = new StiServerConnection("http://*****:40010/");
connection.Users.Login("***", "***");
var dataItem = connection.Items.GetByKey("3d8fe494ee2d4adf84b57ba06e8e9a34");
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Loading reports from Stimulsoft Reports.Server

Post by Alex K. »

Hello,

Please try to use the following code:

Code: Select all

var reportSnapshotItem = connection.Items.Root.NewReportSnapshot("report-snapshot").Save();
var param = new StiReportParameter("ParamName", 99);
var paramList = new List<StiReportParameter>();
paramList.Add(param);
reportTemplateItem.Run(reportSnapshotItem, paramList);
Also, please us the following method

Code: Select all

connection.Accounts.Users.Login("***", "***");
instead

Code: Select all

connection.Users.Login("***", "***");
Thank you.
Post Reply