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

How To Supress a Formula if Parameter IsNull 1

Status
Not open for further replies.

WestView

Technical User
Jan 7, 2003
67
US
Hello All,

I've got a formula based on a user input parameter field array. I have placed this formula in the report footer so that it prints all the parameter values inputted by the user. However, the parameter field is optional. Therefore, if the user leaves the parameter value null, an error occurs when the formula field tries to count the number of elements in the array. My code is below.


numbervar counter1;
stringvar holder1;
counter1 := count({?parameterField}); .
while counter1 > 0 do
(holder1 := holder1 + {? parameterField }[counter1] + Chr(13);
counter1 := counter1 - 1);
holder1 [1 to (length(holder1)-1)]


How do I keep this from happening?

Any/all help will be greatly appreciated!!!

Thanks,

Tom
 
Try adding a command telling formula how to resond to zero length

eg

counter1 := count({?parameterField});

If counter1 = 0 then "" else

while counter1 > 0 do
(holder1 := holder1 + {? parameterField }[counter1] + Chr(13);
counter1 := counter1 - 1);
holder1 [1 to (length(holder1)-1)]

Ian
 
I think you can use your original formula as long as you add a default value like "No Selection" as your topmost value when setting up your parameter. If the user doesn't add anything when asked to select a parameter value, this string will populate the formula.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top