Link to home
Start Free TrialLog in
Avatar of patsylipp
patsylipp

asked on

Parameter inside of an array?

Is that any way I can make it work so that I could have an array that reads off a parameter?

Something like this:
{CONSIGNMENT_CODES.CONSIGNMENT_CODE} in [{?PARAMETER}]

My parameter pulls form a string field where I would enter values in this form:
"value", "value"

I get the erorr message saying that " the array needs to be subscripted"


I have tried setting to a variable but it does not work ...Any ideas?
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

I think I need a bit of clarification here.

Are you saying that your parameter values are based on a single database field and that for each database record this field can contain multiple values separated by a comma?
Avatar of Mike McCracken
Mike McCracken

Don't use the [ ]

{CONSIGNMENT_CODES.CONSIGNMENT_CODE} in {?PARAMETER}

By putting it in [ ], Crystal thinks you are creating a set and thus it wants single values.  Since it is treated as an array you can just use it.  Crystal will also evaluate it correctly as

{CONSIGNMENT_CODES.CONSIGNMENT_CODE} = {?PARAMETER}

mlmcc



Avatar of patsylipp

ASKER

Thanks for your response Savant.

About your first response, yes, that is exactly what is going on.

About {CONSIGNMENT_CODES.CONSIGNMENT_CODE} in {?PARAMETER}

That was the first thing I have tried and it's not working unfortunately.

It reads my field as one big value, it does not distinguish the " "," ", " " for the different strings.

WHat do you mean?

What field is being treated that way?

Is ?Parameter set to accept multiple values?

mlmcc
I am sorry, you need more background info from me.

I am working with a software which has a simple bridge to upload crystal reports into this software so that customers can upload reports to our software and run Crystal from there.

The bridge has this parameter fields"
STR1
STR2

for strings...

so whenever I need to have a parameter onthe report, I create a parameter in crystal named STR1...
Once I loaded it works just fine. According to our developers, STR1 is being pulled as one whole single string value.

We only have STR1 - STR10...which is not enough for the project I am creating at the moment, I will need to enter many different records as a parameters(consignment_codes).

My idea was to be able to enter in STR1 only = "CON1", "CON2", "CON3".....

and have
{CONSIGNMENT_CODES.CONSIGNMENT_CODE} in [{?STR1}]

hoping that crystal would read
{CONSIGNMENT_CODES.CONSIGNMENT_CODE} in [ "CON1", "CON2", "CON3"]

but it doesn't work...crystal recognizes it all as one value and it looks for
"CON1", "CON2", "CON3"]
instead of looking at
"CON1"
and
"CON2"
and
"CON3"
seperately


Do you see any other way I could try in crystal to go around this lack of functionality on the bridge and have many  parameters within STR1 input field in our software??


If you set the parameter to allow multiple values you can enter them individually then Crystal will treat them as an array.

If you want to enter the way you have it you could use

InStr({?Parameter},{CONSIGNMENT_CODES.CONSIGNMENT_CODE}) > 0

mlmcc
I already have it set for multiple values, but the user will be using the bridge and not crystal reports itself...so entering them individually is the main issue, it has to be done all in this one field the entire issue is that the bridge interface doesn't allow you to enter values in the same way the one in crystal does ..

Second option:

It doens't like the parameter {?STR1}, it wants a string. The error message goes away if I do
"{?STR1}", but that wouldn't work since it's looking at it as a value.

 
I just tried it and it works for me.

Where are you adding it?

Are you sure the type is STring?

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of James0628
James0628

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
good call on number one! number two would not work but I ended up going with your last suggestion...the array does not work in crystal for what I was trying to do.

I thoght it would be messy to cresate this report with a command,,,but I tried and the array in sql did just exactly what I was hoping for..cnc.consignment_code =  {?STR1}....and then entered values like:
'value','value2', ...it worked


Thanks for all the help!
You're welcome.  Glad I could help.

 James