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!

Joining Parameter to itself 1

Status
Not open for further replies.

LT2

MIS
May 24, 2006
232
US
Using CRXI w/SQL Svr

Hello, I've got a report basically designed by a SQL Command, however I added {?AgencyName} in Crystal as a static string and imported a list with a default -Any Value- for multiple or discreet values.

@Agencies - Placed in the Report Header
If {?AgencyName} = '-Any Value-'
Then 'ALL Agencies'
Else
If {?AgencyName} <> '-Any Value-'
Then {Command.AgencyName}
Else join({?AgencyName})+ ","

When I run the report and select the agency(s), they do not appear in my header. What is wrong with my formula?

LT
 
I should clarify further. When refreshing the data and looking at the preview, none of the agencies selected appear in the header.

When I run against the db, the data is pulled for the selected agencies, but only the first selected is listed in the header. However, if -Any Value- is selected, ALL Agencies appear in the header but no data is displayed.

I do have {Command.AgencyName}= {?AgencyName} in the Select Expert.

I'm thinking I need to tweak the formula to if -Any Value-
is chosen, then data should be reported on all agencies. I'm unsure of how to write this.

Any suggestions would be greatly appreciated.

Thanks,
LT
 
In report->selection formula->record, enter:

(
if {?AgencyName} <> '-Any Value-'
Then {Command.AgencyName} = {?AgencyName} else
if {?AgencyName} = '-Any Value-' then
true
)

For your display formula in the report header, you can use:

If {?AgencyName} = '-Any Value-' Then
'ALL Agencies' Else
If {?AgencyName} <> '-Any Value-' Then
join({?AgencyName},", ")

The join function will work for one or more selections.

-LB
 
Excellent! Thanks LB.

If I wanted to complicate just a tad, to use Command.ShortName in place of Command.AgencyName because the full names are quite lengthy, possible?

I ask this because the Command.AgencyName is set up as an Automated Variable in the system, so I must show the parm equal to this field.

-LT
 
Do you mean in the display formula? No, you can't, unless you do a manual crosswalk between the parameter value and the short name field. It would be easier to insert a subreport that links the parameter in the main report to the long name in the subreport, but which then displays the short name in the detail section.

-LB
 
Gotcha. Thank you very much LB. You rock!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top