I'm trying to understand the miva_array_filter() function. Ref: http://www.mivascript.com/item/miva_...ilter_ref.html
Syntax: miva_array_filter_ref( array var, offset, element var, filter_expression, output var )
Return value: Count of output array elements.
-- array var = Source array of structures.
-- offset = index in the array to start filtering from.
-- element var = Name of a variable to reference in the filter expression.
-- filter_expression = Text of an expression to execute based on the individual array element.
-- output var = Output array of all structures that tested true in the filter expression.
Given this example:
Where: The element l.method is a reference to the structure member l.methods[n]:method
I'm unclear what the filter_expression is doing.
So if expressed as a mvt:foreach loop what does the mvt:if statement look like?
Also in this example the output is the original array so I assume its being overwritten with the filtered results. Is that true?
Syntax: miva_array_filter_ref( array var, offset, element var, filter_expression, output var )
Return value: Count of output array elements.
-- array var = Source array of structures.
-- offset = index in the array to start filtering from.
-- element var = Name of a variable to reference in the filter expression.
-- filter_expression = Text of an expression to execute based on the individual array element.
-- output var = Output array of all structures that tested true in the filter expression.
Given this example:
Code:
<MvASSIGN NAME = "l.method_count" VALUE = "{ miva_array_filter( l.methods, 1, l.method, 'l.method:paymentcardtype:id GT 0', l.methods ) }">
I'm unclear what the filter_expression is doing.
So if expressed as a mvt:foreach loop what does the mvt:if statement look like?
Code:
<mvt:foreach iterator="item" array="l.methods"> <mvt:if expr="expression"> </mvt:if> </mvt:foreach>
Comment