Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with parameter field used in formatting formula

Status
Not open for further replies.

hartdean

Programmer
Dec 7, 2004
2
GB
I am using CR10, SQL Server 2000 and C# 2003.

I have created a report based on a stored procedure that uses the following 'Suppress (No Drill Down) formula :
Code:
if ({?@PromoLabelType}='R') then true  else false
When I run the report in Crystal it works as expected. When the sql stored proc parameter has value of 'R' it suppresses the section. However, when I attempt to run the report in my app using the Crystal Viewer Control it displays the following error:

This field name is not known.
Details: errorKind
Error in formula: <Section_Visibility>
' if ({?@PromoLabelType}='R') then true else false '

For some reason the parameter field is not recognised when viewing using the Crystal Report Viewer control, but it is when viewing from Crystal Reports directly.

Has anyone come across this problem before?

thanks
Dean

 
I've put reports on the web before using the Crystal Report Viewer, and have always passed the parameters in by code to the report. Are you doing that? If not, how are you expecting the parameter value to be passed into the report?

As far as I know (and I could very well be wrong :)) the Viewer doesn't have an option to prompt for parameters when the report is loaded.
 
Hi Katy

Sorry, I suppose it wasn't too clear what I was doing. The parameter is a parameter of the stored proc, so Crystal sort of inherits that paramater. At run time I am setting the value of the parameter by code in the report which in then passes the parameter down to the stored proc as a sql statement.

I mentioned the parameter as a stored proc parameter just incase it behaved differently to a standalone crystal parameter.

The parameter is being set correctly, and using SQL Profiler i can verify that it is being passed to the database. The required records are then being passed back to the report. It just seems that when using the crystal report viewer it doesn't recognise the parameter name when referenced from a formating formula.

thanks
Dean
 
OK, sorry, I understand now, but don't think I can help as I've never used an SP with Crystal!
When I was putting my reports on the web though, I came across quite a few things that worked fine in the report but were just not supported on the web (by the Viewer I suppose). These included using Commands as a datasource in your report, the property "DrillDownGroupLevel", on demand subreports and a couple of other things. They worked fine in the report but just failed with that type of "Name not known" error when I tried to put them on the web. I wonder if this is one of them?
Sorry I couldn't help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top