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

Issue with Multiple Parameter Value in Header

Status
Not open for further replies.

bkno

Technical User
Feb 23, 2004
10
US
Using Crystal 10 against Oracle 9 I have created a formula to display selected managers (parameters) in the report header. The parameters have been created in Command in order to place select parameter values into subquerries and allows the users (muiltiple value choice). The formula works well until I choose the third value (?Manager3).

end result: manager, manager, manager,

required result: manager, manager, manager

How do I remove the comma?

Formula placed in header: DisplayManagers
stringvar array mList := [{?Manager1}, {?Manager2}, {?Manager3}, {?Manager4}];

if not isnull({?Manager4}) then (mList[1] + ", " + mList[2] + ", " + mList[3] + ", " + mList[4])
else
if not isnull({?Manager3}) then (mList[1] & ", " & mList[2] & ", " & mList[3])
else
if not isnull({?Manager2}) then (mList[1] + ", " + mList[2])
else
if not isnull({?Manager1}) then (mList[1])
 
I think you could change it to:

stringvar array mList := [{?Manager1}, {?Manager2}, {?Manager3}, {?Manager4}];

if len(trim({?Manager4})) > 0 then
mList[1] + ", " + mList[2] + ", " + mList[3] + ", " + mList[4] else
if len(trim({?Manager3})) > 0 then
mList[1] & ", " & mList[2] & ", " & mList[3]
else
if len(trim({?Manager2})) > 0 then
mList[1] + ", " + mList[2]
else
if len(trim({?Manager1})) > 0 then
mList[1];

-LB
 
Worked perfectly. One last question. Where can I find a good resource, be it a a book, tutorial, cd or online course, to learn the kind of coding in your resolution.

Thanks LB.
 
I probably picked up this sort of thing right here in Tek-Tips. There are good basic CR books--the George Peck books, and check out Ken Hamady's site or check his FAQ767-995. The CR help section is good, also.

The above solution was based on testing parameters and noting that they were not null, but instead, blank. The trim() just removed any spaces that might have been entered, so that the length would be zero if empty.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top