Forum OpenACS Development: Response to how to make your var present with upvar conflict

Collapse
Posted by Jun Yamog on
Hi Dan,
<p>
I am sorry that I did not properly use list_to_multirow.  I think it would best that this comment is placed on the ad_proc
<pre>
Accepts a list of lists with the following format
{{row1col1 row1val1 row1col2 row1val2} {{row2col1 row2val1 row2col2 row2val2}
{rowXcol1 rowXval1 rowXcol2 rowXval2}}
</pre>
I have tried to use the current code:
<pre>
set mylist [list [list col1 a col2 b col3 c] [list col1 d col2 e col3 f]]
set mylist2 [list [list a b c] [list d e f]]
template::util::list_to_multirow multi1 $mylist
hw_essay::list_of_lists_to_multirow -varname multi2 -listoflists $mylist
hw_essay::list_of_lists_to_multirow -varname multi3 -listoflists $mylist2 -colnames [list col1 col2 col3]
set test ""
for { set i 1 } { $i <= ${multi1:rowcount}} { incr i } {
        append test "multi1 = [array get multi1:$i]
multi2 = [array get multi2:$i]
multi3 = [array get multi3:$i]
"
}
</pre>
Results in the same output:
<pre>
multi1 = rownum 1 col2 b col3 c col1 a
multi2 = rownum 1 col2 b col3 c col1 a
multi3 = rownum 1 col2 b col3 c col1 a
multi1 = rownum 2 col2 e col3 f col1 d
multi2 = rownum 2 col2 e col3 f col1 d
multi3 = rownum 2 col2 e col3 f col1 d
</pre>
But I think it would be better if we just create a another proc that accepts colnames and arranges the list according to what list_to_multirow accepts.  This proc will then just call list_to_multirow after putting in colnames to the list.  What do you think?