Row2Col II
From Pickwiki
HomePage>>SourceCode>>BasicSource>>Row2Col_II
This utility can quickly transpose a dynamic array item's fields into values, and vice versa.
For example: 0001: apple}banana}cantalope 0001: apple}111}red}0 0002: 111}222}333 becomes 0002: banana}222}green}1 0003: red}green}blue 0003: cantalope}333}blue}0 0004: 0}1}0 i.e. 4 fields with 3 values each becomes 3 fields with 4 values each.
function Row2Col(doc) *// Stuart Boydell Sept 2010 *// swap x & y axis of an array max = dcount(doc,@am) newDoc = raise(doc<1>) for i = 2 to max newDoc = splice(newDoc,char(222),raise(doc<i>)) next i doc = convert(char(222),@vm,newDoc) return(doc) end