DECLARE Ch REFERENCE TO Environment.XML.Parent.Child;
WHILE LASTMOVE(Ch) = YES DO
IF Ch.Grand = 'C' THEN
DETACH Ch;
END IF;
MOVE Ch NEXTCHILD;
END WHILE;
but it does not work. has anyone had success doing something like this. I am trying to do this using references since in the actual code there are hundreds of children.
Joined: 09 Oct 2002 Posts: 100 Location: Kansas City
What finally worked was this
Code:
DECLARE Y INTEGER 1;
WHILE LASTMOVE(Ch) = YES DO
IF Ch.Grand = 'C' THEN
MOVE Ch NEXTSIBLING;
SET Environment.XML.Parent.Child[Y] = NULL;
DECLARE Ch REFERENCE TO Environment.XML.Parent.Child[Y];
ELSE
SET Y = Y + 1; --increment output
MOVE Ch NEXTSIBLING;
END IF;
END WHILE;
I was unable to get DETACH to work within a while loop so I had to use a counter
DECLARE Ch REFERENCE TO Environment.XML.Parent.Child;
WHILE LASTMOVE(Ch) DO
IF Ch.Grand = 'C' THEN
MOVE Ch NEXTCHILD;
DELETE PREVIOUSSIBLING OF Ch;
ELSE
MOVE Ch NEXTCHILD;
END IF;
END WHILE;
I'm using DELETE since it seems that u do not want the segment in the output.
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
I agree with elvis_gn.
njpeeke why can you not use DELETE statement? _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth.
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