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

Use a web servies as a datasource

3 Answers 174 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 1
Rick asked on 26 Jun 2011, 02:59 AM
I am trying to use a web service provided by a third party as a datasource in a Telerik Report.  Anyone have a clue how to do that?

So far I have tried attaching it to an objectDatasource and wrote the following code behind (where ODRC_DATA_SERVICE is the web service reference added to the project and getCurrentMedications("A473813") is the method in the Web Service that returns the data.)  BUt so far I've got nuthin'  Tyhe designed can't detect the data source and the report preview, bets the correct number of rows that the service returns, but does not display any data.

Thanks in advance,

Rick Riedel

private

 

 

void GetCuurMedRpt_NeedDataSource(object sender, EventArgs e)

 

{

 

 

//try

 

 

 

//{

 

 

 

ODRC_DATA_SERVICE ws = new ODRC_DATA_SERVICE();

 

Telerik.Reporting.Processing.

 

Report report = (Telerik.Reporting.Processing.Report)sender;

 

report.DataSource = ws.getCurrentMedications(

 

"A473813");

 

 

 

 

//}

 

 

 

//catch { }

 

 

 

//finally { }

 

}

 

 

private void GetCuurMedRpt_ItemDataBound(object sender, EventArgs e)

 

{

textBox1.Value =

 

"=Field.RXF_ORD_DATE";

 

textBox2.Value =

 

"=Field.DRG_NAME";

 

textBox3.Value =

 

"=Field.RXF_RX_NUMBER";

 

}

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 27 Jun 2011, 08:00 AM
Hello Rick,

Check the following forum thread for more info: Getting data from web service.

All the best,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Rick
Top achievements
Rank 1
answered on 28 Jun 2011, 04:10 AM
Hi Steve,

Sadly, that doesn't tell me anything I need to know, and the original question of that post does not seem to be answered either.

In my case, the Datasource "appears" to be available at design time, but the fields list says "No Data Source".  I say "appears" because when I run a preview, the correct number of rows are returned to the report, but none of the fieldnames delivered by the web service, which I define manually in the ItemDataBinding event, are available and the report displays the error message below for each defined textbox:

 "An error has occurred while processing TextBox 'textBox1': The expression contains object 'Field' that is not defined in the current context."

Below I reprinted all the code behind.  As you can see the only parmeter is hard coded in the datasource constructor, so changing parms is not the issue.  The report clearly recognises the web service and subsequent datasource, since no errors are encountered during the build (only when previewing the report).

So what do I need to do to get this bugger to work?

Thanks,

Rick
 

 

 

public GetCuurMedRpt()

 

{

 

 

this.DataSource = null;

 

InitializeComponent();

}

 

 

private void GetCuurMedRpt_NeedDataSource(object sender, EventArgs e)

 {  

 ODRC_DATA_SERVICE ws = new ODRC_DATA_SERVICE();

();

 Telerik.Reporting.Processing.

 Report report = (Telerik.Reporting.Processing.Report)sender;

 report.DataSource = ws.getCurrentMedications("A473813");
}


private void GetCuurMedRpt_ItemDataBinding(object sender, EventArgs e)  

{

textBox1.Value = "=Field.RXF_ORD_DATE";  

textBox2.Value =  "=Field.DRG_NAME";  

textBox3.Value =  "=Field.RXF_RX_NUMBER";  

}

0
Steve
Telerik team
answered on 01 Jul 2011, 09:22 AM
Hi Rick,

This reply from the referenced thread contains the answer why the preview does not work. If you run the reports from your actual project, the report should be fed with data correctly.

Regards,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Rick
Top achievements
Rank 1
Answers by
Steve
Telerik team
Rick
Top achievements
Rank 1
Share this question
or