Prd
This function is used to calculate the multiplication for a list of numeric elements. It works on a list of elements that can be:
* Expressions.
* Arrays or sub-arrays of an array.
* Properties in an array of references.
prd(ELEMENT_LIST)
ELEMENT_LIST
is a list of ELEMENTS
separated by commas.ELEMENTS
can be:FIRST_INDEX
..LAST_INDEX
. If several dimensions exist, the index range or the index values must be given for all dimensions.INSTANCE(FIRST_INDEX..LAST_INDEX).PROPERTY
.FIRST_INDEX
and LAST_INDEX
are integer value returning an index value in an array.INSTANCE
is the name of an array of instances (class or representation).# Calculates the average value for a list of computed valuesFINAL_PRICE=prd(INITIAL_PRICE, COMPANY_MARKUP, SALESREP_MARKUP)# product on a matrix of values# We have NB_SALESREP sales representative in our department (NB_SALESREP<20)Local Decimal COEFFICIENTS(1..12), INITIAL_VALUE, FINAL_VALUELocal Integer MONTH# Fill the arrayFor MONTH=1 To 12COEFFICIENT(MONTH)=func GET_COEFF(MONTH)Next MONTHINITIAL_VALUE=func GET_INITIAL_VALUE# Find out the final value after a yearFINAL_VALUE=prd(INITIAL_VALUE, COEFFICIENT(1..12))
Decimal, Integer, Float, Double, TinyInt, and Shortint data type variables may be mixed.
If one of the arguments in the function is an array variable without specifying index or range of indexes, all the variable elements are used. The specified index or range of indexes determines the elements to be considered.
If a range of indexes is given such that there is no element to consider, the result returned is 1.