for ord in inn.getloop({'BOTSID':'ST'},{'BOTSID':'HL','HL03':'O'}): #loop over orders
level = ord.get({'BOTSID':'HL','HL01':None}) #get Hierarchical ID Number
out_ordernode = out.putloop({'BOTSID':'OrderHeader'})
out_ordernode.put(....) #adds thing to order header
for lin in inn.getloop({'BOTSID':'ST'},{'BOTSID':'HL','HL03':'I','HL02':level}): #get items that point to the Hierarchical Parent ID (for this order)
out_linenode = out_ordernode.putloop({'BOTSID':'OrderHeader'},{'BOTSID':'OrderLine'})
out_linenode.put(....) #add things to line level
for ship in inn.getloop({'BOTSID':'ST'},{'BOTSID':'HL','HL03':'S'}): out_shipnode = out.putloop({'BOTSID':'OrderStatus'}) out_shipnode.put({'BOTSID':'OrderStatus','ESD':ship.get({'BOTSID':'HL','HL03':'S'},{'BOTSID':'DTM','DTM01':'011','DTM02':None})}) out_shipnode.put({'BOTSID':'OrderStatus','EAD':ship.get({'BOTSID':'HL','HL03':'S'},{'BOTSID':'DTM','DTM01':'017','DTM02':None})}) out_shipnode.put({'BOTSID':'OrderStatus','Carrier':ship.get({'BOTSID':'HL','HL03':'S'},{'BOTSID':'TD5','TD503':None})}) out_shipnode.put({'BOTSID':'OrderStatus','ShipDate':ship.get({'BOTSID':'HL','HL03':'S'},{'BOTSID':'DTM','DTM01':'011','DTM02':None})}) for ord in inn.getloop({'BOTSID':'ST'},{'BOTSID':'HL','HL03':'O'}): level = ord.get({'BOTSID':'HL','HL01':None}) out_ordernode = out.putloop({'BOTSID':'OrderStatus'}) out_ordernode.put({'BOTSID':'OrderStatus','PoNumber':ord.get({'BOTSID':'HL','HL03':'O'},{'BOTSID':'PRF','PRF01':None})}) out_ordernode.put({'BOTSID':'OrderStatus','OrderNumber':ord.get({'BOTSID':'HL','HL03':'O'},{'BOTSID':'REF','REF01':'VN','REF02':None})}) out_ordernode.put({'BOTSID':'OrderStatus','InvoiceNumber':ord.get({'BOTSID':'HL','HL03':'O'},{'BOTSID':'GF','GF01':'IV','GF02':None})}) out_ordernode.put({'BOTSID':'OrderStatus','InvoiceAmount':ord.get({'BOTSID':'HL','HL03':'O'},{'BOTSID':'GF','GF01':'IV','GF04':None})})
for pack in inn.getloop({'BOTSID':'ST'},{'BOTSID':'HL','HL03':'P','HL02':level}): out_packnode = out_ordernode.putloop({'BOTSID':'OrderStatus'}) out_packnode.put({'BOTSID':'OrderStatus','Waybill':pack.get({'BOTSID':'HL','HL03':'P'},{'BOTSID':'MAN','MAN02':None})})HL:S
-> HL:O
-> HL:P
-> HL:I
HL:S
-> HL:O
-> HL:P
-> HL:I
-> HL:O-> HL:I
-> HL:P
HL:S-> HL:I
-> HL:O
-> HL:P
from bots.botsconfig import *
syntax = {}
structure = [{ID:'OrderStatus',MIN:0,MAX:99999},]
recorddefs = { 'OrderStatus': [ ['BOTSID', 'M', 256, 'AN'], ['PoNumber', 'C', 256, 'AN'], ['OrderNumber', 'C', 256, 'AN'], ['ConfirmationDate', 'C', 256, 'AN'], ['CancelDate', 'C', 256, 'AN'], ['ESD', 'C', 256, 'AN'], ['EAD', 'C', 256, 'AN'], ['Carrier', 'C', 256, 'AN'], ['Waybill', 'C', 256, 'AN'], ['OrderNote', 'C', 256, 'AN'], ['ShipDate', 'C', 256, 'AN'], ['InvoiceNumber', 'C', 256, 'AN'], ['InvoiceDate', 'C', 256, 'AN'], ['InvoiceAmount', 'C', 256, 'AN'], ], }