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

using values stored in a "allow multiple item" parameter

Status
Not open for further replies.

Mack2

Instructor
Mar 12, 2003
336
US
We have a parameter that allows the user to enter multiple part numbers. I need to use each one of those part numbers in a calculation. Somehow I need to store each item entered (array?) and then use it in a formula.
Thanks for your help!!!
 
Hi,
Multiple value parameters are stored in an array so you can use any of the array functions to manipulate the contents..

See the Help file for example, but some are

Count({?ParameterName}) returns the # of array items
UBound({?ParameterName)) returns a Number containing the largest available subscript for the given array.

Using these to set up a Loop will let you access each element in the array and act on it..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
You could loop through the parameter array by using a formula like:

numbervar i;
numbervar j := ubound({?parm});
stringvar result := "";

for i := 1 to j do(
if {?parm} = <your condition> then
result := <the result you want> );
result

It would help if you explained what you wanted to do with the formula.

-LB
 
Thanks!!
I need to come up with the sales increase for each part number enter for the parameter. I will give you an example of the user entering 3 part numbers with the sales increase (sales increase is the first 2 digits);

1. 20 part number
2. 10 part number
3. 25 part number
first value, I need sum(partnumber, 20% * lastyearsales)
second value, I need sum(partnumber, 10% * lastyearsales)
third value, I need sum(partnumber, 25% * lastyearsales)

I will extract the percent by grabing the first 2 characters. Thanks for your help!!
 
Where does the lastyearssales come from?

You can extract each sales increase using:

val(left({?MyPartNumber}[1],2))

Where [1] is the index of the parameter partnumber entered.

I'll want specific technical information to address the particulars, such as your software version, database used, example data, and the resultant required output.

-k
 
Try something like:

numbervar i;
numbervar j := ubound({?ptno});
numbervar result := 0;

for i := 1 to j do(
if {table.partno} = {?ptno} then
result := val(left({?ptno},2))/100 * {table.lastyearssales});
result

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top