Posted: Thu Sep 20, 2007 7:51 am Post subject: Problem with indexing in the loop for xml msg
Acolyte
Joined: 18 May 2006 Posts: 69
Hello guys,
This might be a fairly simple question but I have googled a lot but found nothing so posting this problem here for any advice.
Please look at the following:
WHILE I<=J DO
IF (Environment.Variables.Int[Indx]."A" = 'Y') THEN
SET OutputRoot.XML.TS.TSHeader[nInd].Item[nInter].Date = GRP_DATE;
SET nInter = nInter+1;
ELSE
SET OutputRoot.XML.TS.TSHeader[nInd].Pay[nInter].Date = REC_DATE;
SET nInter = nInter+1;
END IF;
SET I = I+1;
END WHILE;
Can I use nInter as the index for both Item and Pay? I tried this , but I get an Array subscript error. If I use different index for pay and Item,I am getting the XML msg but positioning of the children is wrong.
Can anybody suggest me how I can use the same index in the above statement? has anybody come across this issue?
Thanks in advance.
One reason why array subscript errors occur in ESQL is when the code is trying to set, for example, the SECOND element in the (it's not an array)Array when the FIRST element doesn't already exist. _________________ I am *not* the model of the modern major general.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum