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

Printing Optional/Multiple Number Parameter

Status
Not open for further replies.

ajxmas

Programmer
Oct 24, 2007
18
0
0
US
I'm using Crystal 2008 with Oracle DB

I have an optional number parm that can accept multiple entries. I want to print this in the header or "All" if they didn't enter anything.

This formula works fine if something is entered in the parm but gives me an error when nothing is entered. The error I get is "Parameter has no value"

I've tried putting an if hasvalue check in front but it still does not like it.

Any help is appreciated.

My ultimate goal is to either print the word "All" if no parm is entered or the actual parm values.


numbervar counter;
stringvar display;
for counter := 1 to count({?Fare Instrument}) do (
display := display + totext({?Fare Instrument}[counter],0,"") + ", ");
left(display, len(display)-2);
 
numbervar i;
stringvar x;
if hasvalue({?Fare Instrument}) then
for i := 1 to ubound({?Fare Instrument}) do (
x := x + totext({?Fare Instrument},0,"") + ", "
);
if not hasvalue({?Fare Instrument})
then "All" else
left(x, len(x)-2)

-LB
 
Thanks so much, this is exactly what I was trying to do. I guess I had the wrong syntax for the hasvalue when I tried it before. Thanks again for you quick response and expert help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top