MivaScript's array handling seems to be pretty strangely implemented or else
I'm just dumb. I can't figure out how to do this with the
miva_variable_value() function or macro's. Neither seem to work with
structured arrays.
I have a situation where I can't know how many dimensions my array will
require beforehand. I'm loading the entire category tree into a structure
and since there is no way to re-dimension an array and retain it's values
I've been coding using the old techniques formerly supported using macro's.
I'm using this structure g.cattree_1_1_n:name, g.cattree_1_1_n:id,
g.cattree_1_1_n:code.
Top level category: g.cattree_1:id,
Parent level category: g.cattree_1_1:id
Child level category: g.cattree_1_1_1:id and so on for as many levels as
needed.
Where l.cat_var is a string in the form "1_1", I have successfully stored
data in this pseudo array using this technique.
<MvASSIGN NAME="l.cat" VALUE="{ 'g.cattree_' $ cat_var }">
<MvASSIGN NAME="{ l.cat }" MEMBER="id" VALUE="{ Categories.d.id }">
BUT, I can't get the data back out.
Again, where l.cat_var is t string "1_1" the assignment below produces the
string "g.catree_1_1:id"
<MvASSIGN NAME="l.cat_string" VALUE="{ 'g.cattree_' $ l.cat_var $
':id' }">
This assignment fails to do anything...
<MvASSIGN NAME="l.cat_id" VALUE="{ miva_variable_value(l.cat_string)
}">
However, this assignment works!
<MvASSIGN NAME="l.cat_id" VALUE="{ g.catree_1_1:id }">
Question:
Once I have created this string "g.catree_1_1:id" as the name if a variable
that holds Categories.d.id, how do I use that string to get the id stored in
a simple variable?
Comment:
I've already tried <MvEVAL EXPR="{&[l.cat_string];}"> exactly like the
documentation shows.
The compiler produces this error. Found unexpected "&" in expression
Ray Yates
I eventually figured out
Ray Yates
<A HREF ="http://www.flyinghands.com">http://www.flyinghands.com</A>
Comment