Thank you Sandy, I tried both but it didn't give me the desired output. I'm looking for output like this -
However I'm getting output like this -Code:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DataImport> <forecast> <Entity>700</Entity> <data> <date> <day>19</day> <month>1</month> <year>2021</year> </date> <period recID="7001"> <time>8:00</time> <ItemSold>19</ItemSold> <Price>219</Price> </period> <period recID="7001"> <time>8:30</time> <ItemSold>21</ItemSold> <Price>219</Price> </period> </data> </forecast> <forecast> <Entity>701</Entity> <data> <date> <day>20</day> <month>1</month> <year>2021</year> </date> <period recID="7002"> <time>8:00</time> <ItemSold>20</ItemSold> <Price>220</Price> </period> <period recID="7002"> <time>8:30</time> <ItemSold>23</ItemSold> <Price>220</Price> </period> </data> </forecast> </DataImport>
and continues..Code:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <records> <record> <EntityID>700</EntityID> <ItemSold>23</ItemSold> <Price>119</Price> <day>19</day> <month>2</month> <recID>7001</recID> <time>8:00</time> <year>2021</year> </record> <record> <EntityID>700</EntityID> <ItemSold>25</ItemSold> <Price>120</Price> <day>19</day> <month>2</month> <recID>7001</recID> <time>8:30</time> <year>2021</year> </record> <record> <EntityID>700</EntityID> <ItemSold>24</ItemSold> <Price>121</Price> <day>19</day> <month>2</month> <recID>7001</recID> <time>9:00</time> <year>2021</year> </record>
so the entity IDs are not repeated and date is not repeated within entity tag if that helps.




Reply With Quote
Bookmarks