Author |
Message
|
rajasri |
Posted: Fri Feb 16, 2007 2:11 am Post subject: Moving group of fields to another field |
|
|
 Centurion
Joined: 11 Jun 2006 Posts: 114
|
Hi all, i have a problem of moving a group of fields present under Environment as children of a field in OutputRoot. ex:
Environment
-- Folder1
--Field1
--Field2
--Field3
--Field4
My output should have
OutputRoot
--FirstChild
-- XXXX
--YYYY
--Field1
--Field2
--Field3
--Field4.
I am able to do this by having a while loop like this
Move tempRef to Environment.Folder1.Field1;
MOve outputFieldRef To OutputRoot;
WHILE LASTMOVE(tempRef) DO
CREATE LASTCHILD OF outputFieldRef AS outRef NAME FIELDNAME(tempRef);
SET outRef = tempRef;
MOVE tempRef NEXTSIBLING;
END WHILE;
Is there any way to do the same with out using any while loop. The reason of not being interested in while loop is already Field1, Field2 ...are created inside Folder1. Then some how i should be able to move them directly under the OutputRoot. Something like a Bulk Copy-Pasting.
Is there any way to do this. Thanks in advance. |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Feb 16, 2007 2:35 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi rajasri,
Associate your Environment tree with a parser first...search the forum for Environment + parser...
Then try a
Code: |
CREATE LASTCHILD OF outputFieldRef FROM Environment.Folder1.*; |
Not tested, hopefully it will work, else try a DETACH ATTACH also.
Regards. |
|
Back to top |
|
 |
rajasri |
Posted: Fri Feb 16, 2007 4:14 am Post subject: copying groups of fields |
|
|
 Centurion
Joined: 11 Jun 2006 Posts: 114
|
Hi Elvis, i have tried the syntax given by you, but only the first field inside Folder1 is getting copied into the Output. i.e. my output is like this
OutputRoot
--FirstChild
-- XXXX
--YYYY
--Field1
iam loosing the other fields that must follow Field1. And i dont understand the real use of FROM clause after seeing the output. |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Feb 16, 2007 4:29 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi rajasri,
I think my mistake was the '*'. Remove that...use Environment.Folder1 alone.
If it works, then we can discuss what FROM can do
Regards. |
|
Back to top |
|
 |
rajasri |
Posted: Fri Feb 16, 2007 4:42 am Post subject: COPYING |
|
|
 Centurion
Joined: 11 Jun 2006 Posts: 114
|
I tried that also Elvis, but the out put will be
OutputRoot
--FirstChild
-- XXXX
--YYYY
--Folder1
--Field1
--Field2
--Field3
--Field4.
My observation is It takes the field pointed the reference and copies it to the output. But our problem is we dont want that field but the children of the field. If i say Environment.Folder1.* then first child of Folder1 is copied to output. If i say Environment.Folder1 then Folder1 field will be copied to the output. |
|
Back to top |
|
 |
rajasri |
Posted: Fri Feb 16, 2007 4:44 am Post subject: |
|
|
 Centurion
Joined: 11 Jun 2006 Posts: 114
|
my output should have been more clear. here is how it looks
OutputRoot
--FirstChild
------ XXXX
------YYYY
------Folder1
-------------Field1
-------------Field2
-------------Field3
-------------Field4. |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Feb 16, 2007 4:59 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi rajasri,
For the inquisitive kind that I am, I would have tried Environment.Folder1.*[] too, I hope you did too
If that too does not work, then you should try a DETACH ATTACH...
Btw, did you associate your Environment tree with a parser ?
Regards. |
|
Back to top |
|
 |
rajasri |
Posted: Fri Feb 16, 2007 5:05 am Post subject: |
|
|
 Centurion
Joined: 11 Jun 2006 Posts: 114
|
Yes Elvis, i have tried that option too and even before posting the question in forum i have tried attach and detach. And i am getting the same output as showed you in the last post. I really dont understand the use FROM clause. Now atleast i hope you will tell me what its actual use is. And i also dint understand the need of parser. could you pleas explain that also. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Feb 17, 2007 6:44 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rajasri wrote: |
Yes Elvis, i have tried that option too and even before posting the question in forum i have tried attach and detach. And i am getting the same output as showed you in the last post. I really dont understand the use FROM clause. Now atleast i hope you will tell me what its actual use is. And i also dint understand the need of parser. could you pleas explain that also. |
If you do not define a parser where you "park" the tree, the tree's integrity is not guaranteed. So if you park the xml tree in the environment you should do something like this:
Code: |
Create last child of Environment.Data.User domain 'XMLNS' name 'XMLNS';
SET Environment.Data.User.XMLNS = myxmlref; |
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rajasri |
Posted: Sun Feb 18, 2007 8:35 pm Post subject: |
|
|
 Centurion
Joined: 11 Jun 2006 Posts: 114
|
Hi Elvis, i have seen this in the documentation:::
FROM expressions in which a correlation variable represents a row in a message behave slightly differently from those in which the correlation variable represents a row in a real database table.
In the message case, a path involving a star (*) has the normal meaning; it ignores the field's name and finds the first field that matches the other criteria (if any).
In the database case a star (*) has, for historical reasons, the special meaning of "all fields". This special meaning requires advance knowledge of the definition of the database table and is only supported when querying the default database (that is, the database pointed to by the node's data source attribute).
I think this is what is happening for me. iam getting only one field that is the first field. And i feel my requirement cant be satisfied. |
|
Back to top |
|
 |
bhaski |
Posted: Fri Apr 13, 2007 9:42 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hi
Pls let me know what is your actual Input and your expected output?
Bhaski. |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Apr 13, 2007 10:18 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi bhaski,
I don't think anyone would wait 1 month for a solution...
Quote: |
Posted: Fri Feb 16, 2007 3:41 pm |
Regards. |
|
Back to top |
|
 |
recallsunny |
Posted: Fri Apr 13, 2007 12:38 pm Post subject: |
|
|
 Disciple
Joined: 15 Jun 2005 Posts: 163 Location: Massachusetts
|
|
Back to top |
|
 |
|