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

Subreport parameters 1

Status
Not open for further replies.

hencyt

MIS
Mar 14, 2003
122
US
thread767-681462

Same report as post above, different problem. My subreport will not accept more than 2 or three selections from each parameter. I can choose one from every parameter and it works. I can choose "Germany" from Country parameter and it works and I can choose "USA" and "germany" from country parameter and it works, and I can choose "CHINA" and it works-- but if I choose "USA" "GERMANY" AND "CHINA"-- all three countries at once, then Crystal says it encounters an error and shuts down. If I suppress the subreport and run it the same way again, there is no error.

I have already tried reinstalling Crystal.

Only the fragrance parameter will accept several values in the subreport. If I suppress the subreport- I never have this problem, so I know it is related to the subreport. The selection criteria for the subreport and cntr report are in the thread above. (That thread was getting long.)

I tried changing the selection criteria in the subreport from " = " to "IN":

(if {?Pm-?Style} <> &quot;ALL&quot; then {IM_90_UDF_IM_Masterfile.LB_UDF_IMH_STYLE} IN
{?Pm-?Style} else if {?Pm-?Style} = &quot;ALL&quot; then true)

but I still got the error.

The subreport is linked to the container report by each parameter.

Thanks in advance,
Sunny
 
As a work-round, you could define three or four values for a parameter as separate formula fields and pass those.

Madawc Williams
East Anglia, Great Britain
 
Thanks for your reply Madawc. Could you explain what you mean? I guess I don't understand.

Thanks,
Sunny
 
Create formula fields in the main report. Have them select one of the parameters, when suitable, and be blank otherwise. Then pass each of these as a separate field to the subreport.

Madawc Williams
East Anglia, Great Britain
 
There is already 11 different parameters, I would hate to add more- plus I am not sure the users could handle that. That means if they wanted to choose a country for the report they would have to choose values from 2 different fields.

I would think this isn't normal. There must be something in my report or setup causing this to happen.

Thanks again,
Sunny


 
you use this style of record selection in both your main report and subreport...is it only the subreport that is failing?

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Yes. It only fails on the subreport. AND it only fails on the subreport if &quot;too many&quot; parameter values are chosen. If only 2 or 3 are chosen, then all works fine on sub report and main report.

The error only happens if several values are chosen from one parameter; as in the country example I gave above. If I choose 2 fragrances, 2 countries, 1 prod class etc- then it works fine. But if I choose 3 or more countries, or 3 or more prod class etc then it fails.

Does that help?

:) Sunny
 
Would you get the correct data if you eliminated the record selects within your subreports and just let the subreport links on your parameters determine the data in the subreports? It seems odd to me that you are linking on parameters and then specifying potentially different rules by using record selects within the subreports. Also, I wonder whether the position of the subreports within the container report are affecting what values can be returned and causing the conflict that creates the error.

-LB
 
The subreport links on the parameters automatically creates entries in the record selection on the subreport. I did not add any additional record selections- I only modfied the automatically generated criteria.

Here is the subreport record selection criteria:

(if {?Pm-?Select Fragrances} <> &quot;ALL&quot; then
({IM_90_UDF_IM_Masterfile.LB_UDF_IMH_FRAGRANCE_40} in {?Pm-?Select Fragrances} or
{IM_90_UDF_IM_Masterfile.LB_UDF_IMH_FRAGRANCE30} in {?Pm-?Select Fragrances} or
{IM_90_UDF_IM_Masterfile.LB_UDF_IMH_FRAGRANCE20} in {?Pm-?Select Fragrances} or
{IM_90_UDF_IM_Masterfile.LB_UDF_IMH_FRAGRANCE10} in {?Pm-?Select Fragrances} ) else if {?Pm-?Select Fragrances} =&quot;ALL&quot; then true) and
(if {?Pm-?Style} <> &quot;ALL&quot; then {IM_90_UDF_IM_Masterfile.LB_UDF_IMH_STYLE} = {?Pm-?Style} else if {?Pm-?Style} = &quot;ALL&quot; then true) and
(if {?Pm-?CountryOrigin} <> &quot;ALL&quot; then {IM_90_UDF_IM_Masterfile.LB_UDF_IMH_COUNTRY_ORIGIN} in {?Pm-?CountryOrigin} else if {?Pm-?CountryOrigin} = &quot;ALL&quot; then true ) and
(if {?Pm-?FragClass} <> &quot;ALL&quot; then {IM_90_UDF_IM_Masterfile.LB_UDF_IMH_FRAGRANCE_CLASS} = {?Pm-?FragClass} else if {?Pm-?FragClass} =&quot;ALL&quot; then true) and
(if {?Pm-?Product} <> &quot;ALL&quot; then {IM_90_UDF_IM_Masterfile.LB_UDF_IMH_PRODUCT} = {?Pm-?Product} else if {?Pm-?Product} = &quot;ALL&quot; then true) and
(if {?Pm-?Procdesc} <> &quot;ALL&quot; then {IM_90_UDF_IM_Masterfile.LB_UDF_IMH_PROCESS_DESC} = {?Pm-?Procdesc} else if {?Pm-?Procdesc}=&quot;ALL&quot; then true) and
(if {?Pm-?Color} <> &quot;ALL&quot; then {IM_90_UDF_IM_Masterfile.LB_UDF_IMH_COLOR} = {?Pm-?Color} else if {?Pm-?Color}=&quot;ALL&quot; then true) and
(if {?Pm-?ProductClass} <> &quot;ALL&quot; then{IM_90_UDF_IM_Masterfile.LB_UDF_IMH_PRODUCT_VAR} = {?Pm-?ProductClass} else if {?Pm-?ProductClass}=&quot;ALL&quot; then true) and
(if {?Pm-?Fragrance Number} <> &quot;ALL&quot; then {IM_90_UDF_IM_Masterfile.ML_UDF_IMH_FRAG_NUMB} = {?Pm-?Fragrance Number} else if {?Pm-?Fragrance Number}=&quot;ALL&quot; then true) and
(if {?Pm-?Pantone Number} <> &quot;ALL&quot; then{IM_90_UDF_IM_Masterfile.ML_UDF_IMH_PANTONE} = {?Pm-?Pantone Number} else if {?Pm-?Pantone Number} =&quot;ALL&quot; then true ) and
{Component.InvoiceDate} >= {?Pm-?Beginning Date} and
{Component.InvoiceDate} <= {?Pm-?Ending Date}
----------------
The subreport is in the report footer b of the main report.

Thanks so much for helping me think this through.

Sunny
 
hmmm...try this

create a shared array formula

//initializeCountryParm
WhilePrintingRecords;
StringVar countryParm := &quot;&quot;;
NumberVar counter;

for counter := 1 to ubound({?Country}) do
(
countryParm := countryParm + {?Country}[counter] + &quot;,&quot;;
);

countryParm := left(countryParm,length(CountryParm)-1);

countryParm;

Place this in Report Header section and suppress the formula so it doesn't show

instead of linking on the Parameter {?Country} now link on the formula {@countryParm}

modify your record selection formula for this to

(if {?Pm-@countryParm} <> &quot;ALL&quot; then {IM_90_UDF_IM_Masterfile.LB_UDF_IMH_STYLE} IN
{?Pm-@countryParm} else if {?Pm-@countryParm} = &quot;ALL&quot; then true)

or something like that....not sure if the link will be exactly like {?Pm-@countryParm} or not....NOTE make it IN not = in the formula.

Try this out for country...if it works there then adapt it to others

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
that array doesn't have to be &quot;shared&quot;...that was a hold over from an initial thought

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
I should have said by &quot;altering&quot; the record selection criteria in the subreports. It seems to me that if you are linking on all these parameters and then placing the subreport in the report footer that you will only pick up the values in the final group, so that what you might need to do is unlink the subreport. But, this would mean that the parameters for the subreport would have to be entered separately. So then the question becomes, what are you trying to do by using a subreport and could you instead be creating the report without one.

-LB
 
I believe I do have to use a subreport. I tried to avoid it- but could think of nothing else. The whole report is a sales report- the idea is that the user wants to be able to get sales numbers by choosing item characteristics. (i.e How many cinnamon, frosted candles did we sell this year?) Most items and characteristics are stored in our application database. However, there are a few items(the most important ones)that we sell in sets. These sets are assigned just one item number, thus the characteristics of each item in the set are never specified. Our main database does not handle sets like we want it to so salespeople are entering the set item information into an access db that I wrote. I then linked the access tables to tables in SQL.

The main report pulls info for all items that aren't sets. The subreport pulls only items that are in sets. Some items that are sold in sets are also sold by themselves- thus they would show up in both the main and subreports.

I think I have to use a subreport because there could be many set items in a set- so the parent item is repeated and would make totaling accurately difficult.

It took alot of preparation to get this all going. It had to be an access db because the sales people have to enter the data into it and keep it accurate- so it has to be very user friendly.

I don't know if you were really asking for the whole story- but you got it. Let me know if I have other options or if this explanation makes no sense!!!

Thanks a mil-
Sunny

 
Just curious if you tried my solution at all??

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Jim,

I was just trying that. I am familiar with variables and somewhat with counters, I was not familiar with ubound so I was looking it up.

I am trying to understand what you are telling me to do :).

Thanks for checking in. I will post the results in a bit.

Sunny
 
Jim,

Wow- it looks like it worked! I am still not quite sure what we did there...Could you explain it for me?

I guess I would need to make the same changes to each problematic parameter...

Thanks Jim and everyone else!
Definitely would not have come up with that on my own.

Sunny
 
haha...

you are limited in a record selection formula in that you cannot use variables....especially Array variables.

I think there is some bug as I recall with passing a multi-parameter to a subreport.

So...all we did was concatenate the multiparameter into a comma delimited string. then we linked on that string.

Crystal treats strings as though they are arrays in some ways...so you can use the &quot;IN&quot; function on them

UBound is the Upper boundary of an array...so the Ubound(People) = 3 when there are 3 elements in that array people.


Yes....do this solution for EVERY multi-parameter you link on.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
I already made the changes to all the other parameters in this report. Works beautifully.

Thanks for the explanation that helped. If it is a bug, then that makes sense why Crystal was closing on me instead of giving an error within the report. I thought that was very strange.

This report is awesome, now.

Hope someday I can return the favor. Can I interest you in some candles? [wink] [tongue] [wink]

Many thanks-

S
 
let me just say...I have enjoyed this problem. You have described it very well and I know that you have learned from it.

I didn't mind helping you at all ...


Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top