I wasn't planning this, and it turns out to be easy to create this enigma. I've created the array structure in a custom module -- it solved a complex dataset. Now I need to render in a page template. I'm using SMT code here. but I may need to do it in Mivascript too. The issue is I don't know the "max" values so I can stop the loop.
This illustrates what I need:
I won't know the max of total outer and total inner elements:
Maybe the right question, how do I flatten the outer index of g.data.set to get the max array value? Then in the inside loop, flatten the inner index to get the array max?
There is a way to accomplish this, right? Might be simple, but I don't see it.
Thanks,
Scott
This illustrates what I need:
Code:
<mvt:assign name="g.totalouter" value="miva_array_max(g.data:set[l.settings:outercounter][l.settings:innercounter]:element) " /> <mvt:assign name="g.totalinner" value="miva_array_max(g.data:set[l.settings:outercounter][l.settings:innercounter]:element) " />
Code:
<mvt:assign name="l.settings:innercounter" value="1" /> <mvt:assign name="l.settings:outercounter" value="1" /> <mvt:comment> find the value of g.totalouter </mvt:comment> <mvt:while expr="l.settings:outercounter LE g.totalouter"> <mvt:comment> find the value of g.totalinner </mvt:comment> <mvt:while expr="l.settings:innercounter LE g.totalinner"> <mvt:eval expr = "g.data:set[l.settings:outercounter][l.settings:innercounter]:element" /> <mvt:assign name="l.settings:innercounter" value="l.settings:innercounter + 1" /> </mvt:while> <mvt:assign name="l.settings:outercounter" value="l.settings:outercounter + 1" /> </mvt:while>
There is a way to accomplish this, right? Might be simple, but I don't see it.
Thanks,
Scott
Comment