Author |
Message
|
RITCHEA |
Posted: Thu Oct 13, 2011 1:34 am Post subject: MOVE statement |
|
|
Apprentice
Joined: 25 Jul 2011 Posts: 27
|
if my tree structure is like
data.customer.fname
data.customer.lname
data.customer.age
I want to move from fname to lname and then age using move statement in ESQL.... Is that possible. |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Thu Oct 13, 2011 2:03 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
|
Back to top |
|
 |
RITCHEA |
Posted: Thu Oct 13, 2011 2:09 am Post subject: |
|
|
Apprentice
Joined: 25 Jul 2011 Posts: 27
|
I tried MOVE nextsibling but it didnt work... |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Thu Oct 13, 2011 2:15 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
Can you provide your code and symptoms?
--
marko |
|
Back to top |
|
 |
RITCHEA |
Posted: Thu Oct 13, 2011 2:42 am Post subject: |
|
|
Apprentice
Joined: 25 Jul 2011 Posts: 27
|
Set Environment.variables = THE(select p.Start from Database.email_req AS p);
Set Environment.variables = THE(select t.ended from Database.email_req AS t);
-- ---- work ---------
DECLARE i INTEGER;
SET i=1;
while (i<=7) do
set Environment.variables.fields[i]= '' ;
set i=i+1;
END WHILE;
declare fields reference to InputRoot.MRM.data.fname;
-- WHILE LASTMOVE (fields) Do
WHILE (Environment.variables.Start <= Environment.variables.ended) DO
SET Environment.variables.fields[Environment.variables.Start] = fields;
SET Environment.variables.Start = Environment.variables.Start+1;
-- MOVE NEXTCHILD TO fields;
-- MOVE fields nextsibling;
-- MOVE fields PARENT;
-- MOVE NEXTSIBLING to fields;
-- MOVE fields to NEXTCHILD ;
END WHILE;
END WHILE;
This is code i am going in problem with |
|
Back to top |
|
 |
MrSmith |
Posted: Thu Oct 13, 2011 2:54 am Post subject: |
|
|
 Master
Joined: 20 Mar 2008 Posts: 215
|
to move from the fname to lname
Decalre yourself a reference that points to the structure data.customer
then
MOVE myref FIRSTCHILD TYPE 0x01000000 Name 'lname';
consequently
MOVE myref FIRSTCHILD TYPE 0x01000000 Name 'age';
You dont have to use the TYPE 0x01000000 but it clarifies that the search is for an Element not an attribute
Using LASTMOVE to check the move worked out OK.
you can then add repeats etc whatever as per the MOVE statement help _________________ -------- *
“Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.”
Last edited by MrSmith on Thu Oct 13, 2011 2:57 am; edited 1 time in total |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Thu Oct 13, 2011 2:56 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
Can you describe what you want to do as step by step algorithm?
--
Marko |
|
Back to top |
|
 |
RITCHEA |
Posted: Thu Oct 13, 2011 3:01 am Post subject: |
|
|
Apprentice
Joined: 25 Jul 2011 Posts: 27
|
I am trying to Move to next child element in loop ....
Get the start and end field index from the database.
Initialize an array variable Fields[10] with default values of each
field.
Declare Fields character;
Declare i interger;
Set i=0
While i<10
Begin
Set Fields[i]=null;
i=i+1;
End;
From database :
startIndex=4;
endIndex=8;
Set the values of array with the incoming message field values starting
from
get reference of first element of the incoming message.
Declare custRef reference to InputRoot.MRM.data[1];
While(startIndex <=endIndex)
Begin
Fields[startIndex]=customerRef;
startIndex=startIndex+1;
move custRef;
End; |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Thu Oct 13, 2011 3:19 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
You should reread what is difference of NEXTSIBLING and FIRSTCHILD.
If i'm right followinf pseudo code should be helpful
Code: |
InputRoot.
MRM.
data. <-- rReference points here after step 1)
customer. <-- rReference points here after step 2)
fname <-- rReference points here after step 3)
lname <-- rReference points here after step 4)
age
1) DECLARE rReference TO InputRoot.MRM.data;
2) MOVE rReference FIRSTCHILD;
3) MOVE rReference FIRSTCHILD;
4) MOVE rReference NEXTSIBLING;
|
Marko |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 13, 2011 3:32 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
To clarify:
The MOVE statement does not assign any data. You have to use the SET statement for that.
The MOVE statement changes the pointer of a reference. Always check if LASTMOVE(ref) to make sure that the given change in pointer was successful.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|