Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1361
  • Last Modified:

Crystal Report Parameters from Delphi: Error 656

New to Delphi and Crystal Report, maintaining a Delphi application interfacing to Crystal Reports.

A couple of report interfaces from Delphi are having parameter problems as follows:

Calls to PEGetNParameterFields and PEGetNthParameterField indicate more parameters than I can find in the .rpt file. In one instance the parameters are repeated such that the names of the first 4 parameters returned from PEGetNthParameterField equal the names of the next 4. PEGetNParameterFields said 8 parameters and I can only find the 4 in the .rpt file. In the other instance I find 8 parameters in the .rpt file and PEGetNParameterFields and PEGetNthParameterField reveal 12 with the first 8 as expected and the last 4 different to any of the 8.

In both cases calls to PESetNthParameterField, one past the number of parameters I see in the .rpt (the logic looping for the number got from PEGetNParameterFields) produce the 656 error which I see in Crystal Help described as "Operation illegal on linked parameter."

I don't understand where PEGetNParameterFields and PEGetNthParameterField are getting their info. from and why it should differ with where PESetNthParameterField is aimed. Any help greatly appreciated.
0
matthewmiddleton
Asked:
matthewmiddleton
  • 2
  • 2
1 Solution
 
mlmccCommented:
Does your report have a subreport?  If so does the subreport require parameters?

mlmcc
0
 
matthewmiddletonAuthor Commented:
You were on the right track. The get gets all parameters. The logic was then putting values into the "main" parameters, ignoring the subreport parameters but then looping through all the parameters performing the Set for each. When doing a Set the crash occurred on those subreport parameters that take their input from things (parameters I think) on the main report, the ones the logic had ignored. Essentially the code looked like:

   NewReport.Crpe1.ParamFields.Retrieve;

   //do some stuff to specific ParamFields

   NewReport.Crpe1.ParamFields.Send;

I solved the problem by altering that to:

   NewReport.Crpe1.ParamFields.Retrieve;

   //do some stuff to specific ParamFields

   for cnt := (NewReport.Crpe1.ParamFields.Count - 1)downto 0 do
     if not NewReport.Crpe1.ParamFields[cnt].NeedsCurrentValue then
        NewReport.Crpe1.ParamFields.Delete(cnt);

   NewReport.Crpe1.ParamFields.Send;


Thanks for your comment.
0
 
matthewmiddletonAuthor Commented:
Not the answer but would have got me going in the right direction if I hadn't figured the same myself in the meantime...quick response to
0
 
mlmccCommented:
Glad to help

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now