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

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 596
  • Last Modified:

Subscript out of range when calling crystal report from Delphi VCL version 5.5.1

I deploy multiple versions of reports to my customers.  Some of the reports will require certain parameters and others won't.  Here's my problem.  If I add a parameter to one report, I have to add it to all versions of the report regardless of whether they use it.  If I don't and try to run a report using a report source file that doesn't contain it I get Error:116 Subscript out of range :: ParamFields[ paramfield number].  I understand why this is happening, but is there any way I can get around it.  (i.e. if the parameter doesn't exists, just ignore it)

I'm using Crystal 8.5,  Delphi 5 and Delphi VCL version 5.5.1
Randy Rich
Randy Rich
1 Solution
I don't know what the VCL exposes but I wrote a program in VB6 using the RDC that "knew" the names of the parameters and searched the report for them then assigned values.  So if a parameter didn't exist a value wouldn't be passed even if the application thought one was needed.

You should be able to get at the number of parameters the report requires and I would assume the names.

How does your application just prompt for the parameters?

Ephraim WangoyaCommented:

I dont use Crystal Reports but generally in delphi, objects that implement some kind of Parameter list normally have methods for searching parameters



also check for a Count property
Randy RichPresidentAuthor Commented:
Yes, the component was using a paramfields property which was based off of tstringlist and therefore had a count property.  Thanks for the help

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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