Page 2 of 2

Re: Loading reports from Stimulsoft Reports.Server

Posted: Tue Mar 29, 2016 2:53 pm
by JNieto
OK! I will have that into account. Thanks for being so kind!

Re: Loading reports from Stimulsoft Reports.Server

Posted: Tue Mar 29, 2016 5:26 pm
by Andrew
Hello,

We are glad to help you.

Thank you.

Re: Loading reports from Stimulsoft Reports.Server

Posted: Thu Mar 31, 2016 8:04 am
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!

Re: Loading reports from Stimulsoft Reports.Server

Posted: Thu Mar 31, 2016 11:35 am
by Alex K.
Hello,

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

Thank you.

Re: Loading reports from Stimulsoft Reports.Server

Posted: Thu Mar 31, 2016 12:02 pm
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");

Re: Loading reports from Stimulsoft Reports.Server

Posted: Thu Mar 31, 2016 1:17 pm
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.