Thursday, April 28, 2011

Missing Parameter in Web Service...

I am currently working on an Webservice to retrieve a pdf Document from an Crystal Report. As lonmg as there are no parameter Values in the Report, the service works fine. As soon as I use parameters in a Query the Reports can't be shown anymore and I retrieve an error like 'missing parameter values'. But there is only one Parameter and I am pretty sure that I set the value of that parameter... Here is the Code where I change/ add the value:

// param is a string like 'parametername:value'
string index = param.Split(':')[0];
string value = param.Split(':')[1];
// repDoc is the current Report
repDoc.ParameterFields[index].CurrentValues.Clear();
repDoc.ParameterFields[index].CurrentValues.AddValue(value);
// now i create the PDF as an HTTPresponse
repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, response, false, "Report");

I really have no idea why it doesnt work...

From stackoverflow
  • Try to debug if param is really set?

    I am sure != I checked it

    Gushiken : I have checked it and.. its set... the property 'hasCurrentValue' is true...
  • I have found the mistake... I did a repDoc.refresh() before I created the Report.. seems like the Parameter Values are dropped that way... after removing the Refresh everything works fine :)

    thx for the help!!!

    Gushiken

    Gushiken : Why do I have to wait 48h to accept my own answer? Hm... I will accept it later, but the problem is solved I guess^^

0 comments:

Post a Comment