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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Parameters using Function Fields

Status
Not open for further replies.

RobertMottram

Programmer
Apr 25, 2002
39
GB
We have some software which passes Parameters into a Crystal Report. These software can not be changed but it passes the parameters as Formula fields called PARAM1, PARAM2 etc. You can also but in multiple values for each parameters select a number of records.
I am trying to write a small VB application which can pass the parameters to the same reports, but allowing the parameters to be pulled from a different source. My problem is I can send one value through, but I want to be able to set multiple values for one parameter and I can find no way to do this. Does anyone have any ideas how this could be done.
In the examples I have the PARAMs are in both selection formula and displayed on the forms. I am think that the program we have can do it, so there must be a way, I just can not find it!

Thanks for any help you can thing of.

Robert
 
You need to create a collection of parameters:
Dim a As CRAXDRT.ParameterValues
Fairly easy once you've found that bit.
 
I managed to work this out for Parameter Fields, but I could not find a way of using this to set multiple values for a formula field
 
Sorry, I misread the original email.
Could you pass a parameter as comma separated then use split to break it down into an array?
 
Formula fields do not appear to allow for more the one result as I tried just setting the formula field as an array in the first place just to be able to enter multiple values manually before trying to get it into code.
 
If you pass the string to the formula, then create the array in a shared variable.
Can;t you just use parameters like normal?
The only way to display an array is by parsing it in a for..next loop into a string.
 
I might well end up just using parameters like nomal. The only reason I would ask if any know of a way to do this is I would like to right a frount end which will work without me have to change the current reports in any way. This just happens to be the way the current reports we have are created. I think I will have to change the reports!
I think the current ones almost run through once for each set of values you set, and teh sort adn order all the results that come out before printing. I can not see how they did this, so I will do it my way (which seams to be the better way and the way VB/Crystal want things done)
Thanks a lot for you help

Rob
 
I am still having problems with every way I try to do this. If I use parameter fields, if you run the report directly crystal will come up every time and ask for the parameters. I think this is why the other program we have used Formula fields. Is there a way to tell crystal not to come up with the prompt box? or can any one think of a way to use formula fields where I would be able to enter more than one value into the formula field?
If I can not resolve any of these problems, for now I am going to have to edit the selection forumla from VB. The problem with this is it means that the VB program needs to know the database field to compaire to and the type of compaire (<, >, =, etc). I am going to be writting this fround end to call a number of reports so I was hoping most of this information could be stored in the report.

Any ideas any one

Thanks

Rob
 
I have just managed to find a solution. Infact once I managed to understand exactly what formula fields do it became more clear.
I have PARAM1 as a formula and in the select formula have CLIENT_ID={@PARAM1}. To then get it to work I have to send this to the formula feild
Code:
IF {CLIENT_ID} in [1,2,7,10] THEN 
     {CLIENT_ID}
ELSE
      0

This then all works so long as their is no CLIENT_ID 0.

Thanks for your help. The only question I have is can you set something to Null or empty in a Crystal function?

Thanks

Rob

 
No, you could only set it to 0 or an empty string etc

Andrew Baines
Chase International
 
Hello Hi!
I want to pass the parameters from a visual basic application to crystal report.i have done it by using this statment
repObj.parameterFields(0)=&quot;<parameter name>;&quot;&<parameter value>&&quot;;true&quot;

I am giving the values to the parameters but the problem is this it's again prompting for the values in the craystal report.How can i skip this prompting message.
Please reply soon if some one have the idea about it.

from
kashif
 
I know that when I was looking around at passing parameters I found something about this, I just can not remember where.
I ended up passing everything by formula fields in the end.
I will try and find the solution for you again, but it was in one of two places. Either repObj.something or there is a setting on the report itself.
Sorry this is not that much help. I will try and find out for you

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top