Iterating sideways and down!

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi all,
I have a table like this :
PK Unit_ID Value_A Value_B Value_C<br/>
1 1 10 20 30<br/>
2 1 22 21 19<br/>
3 2 11 12 13<br/>
4 2 33 56 33
I want to extract and iterate the data in a manner that allows me to create an XElement for each Value_? columns with each XElement containing a number of attributes equal to the number of unique unit ids.
So I want to get in XML something similar to this:
<Value_A Unit_1=10 Unit_2=11 /><br/>
<Value_A Unit_1=22 Unit_2=33 /><br/>
<Value_B Unit_1=20 Unit_2=12 /><br/>
<Value_B Unit_1=21 Unit_2=56 /><br/>
<Value_C Unit_1=30 Unit_2=13 /><br/>
<Value_C Unit_1=19 Unit_2=33 />
Ive been scratching my head on this for some time so Id appreciate your help on this, assuming of course that it can even be done.
--
Moo
<hr class="sig Moo

View the full article
 
Back
Top