How to set Design-Time values for web service datasource parameters programmatically?

1 Answer 390 Views
DataSources General Discussions Rendering
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
Tursunkhuja asked on 23 Nov 2021, 10:47 AM

Hi,

Web Service Data Source has parameters as you can see from the picture below. We can define design-time value for the parameters. The design-time values help us during designing our report (for example, we can see selected properties from standalone & web report designer). In our case, we also need to modify some report programmatically, we need to create new web service data source or update existed one. 

  The question is how to set design-time value for a parameter of web service data source programmatically? 

Mirzodaler
Top achievements
Rank 1
Veteran
commented on 25 Nov 2021, 05:17 AM

Hi,

We are getting the following error in the report web designer when the design-time values are not set. 

This is actually also happening in Standalone designers as well.

 

The report is generated programmatically so we want to set the design-time values as well so that users can quickly open and modify the report.

 

Thanks,

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 25 Nov 2021, 02:47 PM

Hello Tursunkhuja and Mirzodaler,

The Design-Time parameters' values are stored in an internal string property called ParameterValues and as such, I am afraid that its value cannot be edited through outside code. 

I have attached a sample TRDX report that uses the WebServiceDataSource which has one parameter, here's how the design-time value is written:

  <DataSources>
    <WebServiceDataSource ParameterValues="{&quot;q&quot;:&quot;Telerik Reporting&quot;}" AuthParameterValues="null" ServiceUrl="https://www.googleapis.com/books/v1/volumes" Name="webServiceDataSource1">
      <Parameters>
        <WebServiceParameter WebServiceParameterType="Query" Name="q">
          <Value>
            <String>= Parameters.ParameterQ.Value</String>
          </Value>
        </WebServiceParameter>
      </Parameters>
    </WebServiceDataSource>
  </DataSources>

The only way you could theoretically edit the design-time properties through code is if you were to serialize the report to XML (TRDX extension) and then edit the existing XML programmatically(or by hand).

Regarding the errors when there are no design-time values, the problem is that the engine uses the design-time values to get a preview of the data and generate the fields' schema from it, so the design-time data is necessary.

Please let me know if you have any other questions.

Regards,
Dimitar
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Mirzodaler
Top achievements
Rank 1
Veteran
commented on 26 Nov 2021, 04:04 AM

Dear Dimitar,

Thank you for your response. Yes, at this point we can work around it by editing the XML file programmatically.

Is there any reason to not include this in API? If not, can you please create a feature request where we will be able to set those values programmatically?

As we go more with creating reports programmatically and adding datasources, this is crucial for our use cases.

Thanks!

Dimitar
Telerik team
commented on 26 Nov 2021, 01:33 PM

Hello,

We have recognized the need for this functionality and for that reason, I have created a feature request on behalf of Tursunkhuja and have cast his and your votes on it in order to increase its priority - Make the Design-Time parameter values of the WebServiceDataSource editable through code.

Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
commented on 28 Nov 2021, 04:29 AM

Thank you.
Tags
DataSources General Discussions Rendering
Asked by
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Dimitar
Telerik team
Share this question
or