ibm mq - LASTMOVE loop is not working -
my xml looks
- <itemmaster> - <itemmasterheader> + <itemid> + <itemstatus> + <userarea> - <classification type="homologation class"> - <codes> <code>e</code> </codes> </classification> + <classification type="lp"> + <classification> - <classification type="brand"> - <codes> <code>002</code> </codes> </classification> yhe full xml here http://www.speedyshare.com/mgcca/download/itemmaster-2.xml
i need fetch value of classification attribute type= "brand" below code, fetchs classification attribute type = "homologation class" dont want since calling "brand". tried apply lastmove dosent work. please tell me wrong.
i have fetch other values codes inside type -"lp" also.
declare rresource reference inputroot.xmlnsc.*:syncitemmaster.*:dataarea.*:itemmaster.*:itemmasterheader[1]; set rowcnt = rowcnt+1; declare linecount integer 1; while lastmove(rresource) = true set outputroot.xmlnsc.root.row[rowcnt].product_info.tyrebrandcd = (select item fieldvalue(t) itemmaster.*:itemmasterheader[linecount].*:classification.*:codes.*:code t fieldvalue(itemmaster.*:itemmasterheader[linecount].*:classification.(xmlnsc.attribute)type) = 'brand'); set linecount = linecount + 1; move rresource nextsibling repeat type name; end while; return true; end; thanks
tried below suggested code
here trace logs
2013-05-10 18:32:27.218385 7732 usertrace bip2537i: node 'wmb_9d1_prod_sub00_001.9d1_prod': executing statement ''set temp = (select t.classification :classification myref t fieldvalue(t.classification.(xmlnsc.attribute)type) = 'brand');'' @ ('.wmb_9d1_prod_sub00_001.main', '22.3'). 2013-05-10 18:32:27.218393 7732 usertrace bip2538i: node 'wmb_9d1_prod_sub00_001.9d1_prod': evaluating expression ''the (select t.classification :classification myref t fieldvalue(t.classification.(xmlnsc.attribute)type) = 'brand')'' @ ('.wmb_9d1_prod_sub00_001.main', '22.14'). 2013-05-10 18:32:27.218400 7732 usertrace bip2572w: node: 'wmb_9d1_prod_sub00_001.9d1_prod': ('.wmb_9d1_prod_sub00_001.main', '22.14') : finding 1 , select result. 2013-05-10 18:32:27.218427 7732 usertrace bip2539i: node 'wmb_9d1_prod_sub00_001.9d1_prod': evaluating expression ''myref'' @ ('.wmb_9d1_prod_sub00_001.main', '22.48'). resolved ''myref''. result ''row... root element type=16777216 namespace='' name='itemmasterheader' value=null''. 2013-05-10 18:32:27.218437 7732 usertrace bip2539i: node 'wmb_9d1_prod_sub00_001.9d1_prod': evaluating expression ''xmlnsc.attribute'' @ ('.wmb_9d1_prod_sub00_001.main', '22.94'). resolved ''xmlnsc.attribute''. result ''1095266992384''. 2013-05-10 18:32:27.218446 7732 usertrace bip2540i: node 'wmb_9d1_prod_sub00_001.9d1_prod': finished evaluating expression ''fieldvalue(t.classification.(xmlnsc.attribute)type)'' @ ('.wmb_9d1_prod_sub00_001.main', '22.65'). result '''homologation class'''. 2013-05-10 18:32:27.218454 7732 usertrace bip2539i: node 'wmb_9d1_prod_sub00_001.9d1_prod': evaluating expression ''fieldvalue(t.classification.(xmlnsc.attribute)type) = 'brand''' @ ('.wmb_9d1_prod_sub00_001.main', '22.117'). resolved '''homologation class' = 'brand'''. result ''false''. 2013-05-10 18:32:27.218461 7732 usertrace bip2569w: node 'wmb_9d1_prod_sub00_001.9d1_prod': ('.wmb_9d1_prod_sub00_001.main', '22.14') : clause evaluated false or unknown. iterating clause. 2013-05-10 18:32:27.218469 7732 usertrace bip2570w: node 'wmb_9d1_prod_sub00_001.9d1_prod': ('.wmb_9d1_prod_sub00_001.main', '22.14') : there no items in clause satisfying clause. 2013-05-10 18:32:27.218503 7732 usertrace bip2567i: node 'wmb_9d1_prod_sub00_001.9d1_prod': assigning null ''temp'', deleting it.
try this:
declare temp row; set temp = (select t.classification rresource t fieldvalue(t.classification.(xmlnsc.attribute)type) = 'brand'); outputroot.xmlnsc.root.row[rowcnt].product_info.tyrebrandcd = temp.code;
Comments
Post a Comment