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

Display Multiple Descrip from Formula

Status
Not open for further replies.

pcollins1

Technical User
Jun 19, 2002
72
US
Crystal 8.5 I have a parameter fields that can be multiple plant codes. I created a formula field to coincide with the plant codes and listed descriptions.

In report header I want disply Plant code along with the description from formula field.

If user select one plant then it works, but if they select multiple plants then it displays the first chosen plants description(Plant Name) not the second in both({@PlantName) positions

I end up with Plants 3 Town1 and 7 Town1.

Should be Plants 3 Town1 and 7 Town2

Plant Description Formula:
If ({?Plant})="3" then stringVar PlantName:= "Town1" else
If ({?Plant})="7" then stringVar PlantName:= "Town2" else
If ({?Plant})="10" then stringVar PlantName:= "Town3"

Report Header Formula
if count({?Plant}) = 2 then "Plants" + ToText (Minimum{?Plant})) + " " +ToText({@PlantName}) + "and" + ToText(Maximum{?Plant})) + " " + ToText({@PlantName})

How could I make the Plant description Formula work for multiple descriptions?
 
Create a formula like this:

stringvar parmdesc := "";
numbervar i := 0;
numbervar j := ubound({?plant});

for i := 1 to j do(
parmdesc := parmdesc + totext({?plant},0,"") +" "+(
if {?plant} = 1 then "Town1" else
if {?plant} = 7 then "Town2" else
if {?plant} = 10 then "Town3"
)+ ", ");
"Plant"+
(if ubound({?plant}) > 1 then "s " else " ")+
left(parmdesc, len(parmdesc)-2);

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top