Link to home
Start Free TrialLog in
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)Flag for United States of America

asked on

Ordering of parameters changes in Crystal

CR 9

When i open the report in CR 9, the parameters are in the order i want.
When Crystal is called by our program, the report parameters are in a different order.

our program uses CR 9 library.

what is causing the parameters to be re-ordered?
Avatar of Mike McCracken
Mike McCracken

WHat do you mean they are reordered?

Are you entering through the Crystal parameter screen or through code?

mlmcc
Avatar of zephyr_hex (Megan)

ASKER

see the image below.
example.jpg
What order did you add the parameters in?

If you right click PARAMETERS in the FIELD EXPLORER do you have an option to SET PARAMETER ORDER?

mlmcc
here is what i see when i right click parameters in field explorer (see pic below).

the title parameter was added first, and then re-ordered using the Move Parameter Up/Down.

and i don't know if it makes a difference, but p_oih_id_start and p_oih_id_end are passed to an informix stored procedure

params.jpg
i tried deleting the title param, save the report, and then add the title param back in...
the problem still exists.
Order on that screen should not matter.

Are the 2 parameter SP parameters or did you build Crystal parameters for them?

If you eliminate the title parameter does the report pass them correctly?

mlmcc
p_oih_id_start and p_oih_id_end are parameters from the stored procedure
znbr~title is a parameter created in crystal

is there a way to build parameters in crystal for parameters from stored procedures?

if i eliminate the title parameter, the code shows the parameters are being called in the correct order.

if i move the title parameter to the stored procedure, the code calls the title parameter last (correct).

i need to know why this is happening.  i have hundreds of reports where there's a mix of parameters from stored procedure and parameters from crystal.
so, even though i can fix this one report by moving the title parameter to the stored procedure, that is not an ideal solution.
Are you passing the parameters through code or from the parameter prompting page?

mlmcc
code passes the values to the parameters.

but code is getting the parameter names from crystal.  for example, i changed the title param name in crystal to znbr_title, and code picks this up:
PARAMETERS
[znbr_title = 149748]
[p_oih_id_start = 149748]
[p_oih_id_end = 0]

should be:
PARAMETERS
[p_oih_id_start = 149748]
[p_oih_id_end = 149748]
[znbr_title = 0]
How is the code passing the parameters.

You can pass by name

mlmcc
the code doesn't pass by name.  
and we really don't want it to... because the code needs to work for both Informix and SQL 2005, and the naming scheme of parameters from a stored procedure differs.  we don't want to have to "hard code" parameter names for both database versions.

the code asks crystal for the parameters.  the code knows which order the parameters occur in, and passes database values based on that order.

The problem does not happen in SQL 2005.  The report structure is the same... where the p_oih_id parameters are in the stored procedure, and the title parameter is in Crystal.  in this case, Crystal passes the parameter names to the code in the correct order:

PARAMETERS
[@p_oih_id_start = 46209]
[@p_oih_id_end = 46209]
[znbr~title = 0]

the code calls Crystal in the same way for both versions of database.
Are you using the same report for 2 different databases?  Or is it 2 separate reports which are identical.

mlmcc
it is two different reports, two different databases.  the reports are different because of the difference in the way Informix & SQL 2005 return variables from a stored procedure
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

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
SOLUTION
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