AnsweredAssumed Answered

GEL - Loop to build XML

Question asked by Keri Taylor on Jan 6, 2017
Latest reply on Jan 20, 2017 by Keri Taylor

Hello guru's, I have worked very hard on this today... but I am still having some issues trying to get this to work. I can't seem to figure out how to do the loop and store the variables into the xml write. I can totally do this from a query, but for some reason, I can't figure it out yet on the xml read. It only does just the one row and not all three. Ugh.

1. did the read

2. stored the data

3. now i need to loop through and save the data into the segments.

   ie. 

<HardAllocCurve>
     <segment finish="2016-12-25T00:00:00" rate="1.0" start="2016-10-02T08:00:00"/>
     <segment finish="2016-12-30T00:00:00" rate="1.0" start="2016-12-27T00:00:00"/>
     <segment finish="2017-09-29T00:00:00" rate="1.0" start="2017-01-02T00:00:00"/>
</HardAllocCurve>

part of the code that i need help with. 

<!-- loop over the segments node and pull the start,finish and rate-->  
<gel:forEach var="segments" select="$result/soapenv:Envelope/soapenv:Body/NikuDataBus/requisitions/requisition/requisitionResource/requestCurve/segment"> 
     <gel:set asString="true" select="$segments/@finish" var="segfinish"/>
     <gel:set asString="true" select="$segments/@start" var="segstart"/>
     <gel:set asString="true" select="$segments/@rate" var="segrate"/>
     <gel:log level="SEGMENTS" category="DEBUG" message="start=${segfinish}, finish=${segfinish}, rate=${segrate}"/>

     <gel:parse var="hardXML">
          <HardAllocCurve>
               <segment finish="${segfinish}" rate="${segrate}" start="${segstart}"/>     
          </HardAllocCurve>
     </gel:parse>
     
     <gel:include select="$hardXML"/>
     
</gel:forEach> 
<!-- print out the hardXML results -->
<gel:log level="Info">
     <gel:expr select="$hardXML/"/>
</gel:log>

it is at least displaying them,

but only the first row in the HardAllocCurve/segment node.

So, the xml file becomes this, when the rest of the code is run:

And i need it to have all three segments.

 

Please someone help, I am going crazy.Does anyone have any suggestions I can try or please point me in a direction. I have read the numerous posts on this in the community, and i have to say... it's gotten me this far!! 

 

Thank you for any help provided.

 

Keri

Outcomes