| Author | 
		  Message
		 | 
		
		  | tanishka | 
		  
		    
			  
				 Posted: Wed Oct 27, 2010 6:46 pm    Post subject: CREATE LASTCHILD ISSUE | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 24 Nov 2008 Posts: 144
  
  | 
		  
		    
			  
				Hi,
 
 
 I need to store input message in env varibles like below format.
 
<Message>
 
<Header>
 
--
 
--
 
</Header>
 
<Data>
 
<No></No>
 
<Supplier></Supplier>
 
<Buyer></Buyer>
 
<Details> -- unbounded
 
--
 
---
 
--
 
</Details>
 
</Data>
 
</Message>
 
 
CREATE LASTCHILD OF Environment.Variables.Message.Data NAME 'Details';
 
DECLARE outdtlref REFERENCE TO Environment.Variables.Message.Data.Details;
 
 
SET outdtlref .BOL = '';
 
SET outdtlref .Address = '';
 
 
Here the problem is Details folder creating. But the fields in this folder not populating? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Wed Oct 27, 2010 8:01 pm    Post subject: Re: CREATE LASTCHILD ISSUE | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				
   
	| tanishka wrote: | 
   
  
	Hi,
 
 
   
	| Code: | 
   
  
	CREATE LASTCHILD OF Environment.Variables.Message.Data NAME 'Details';
 
DECLARE outdtlref REFERENCE TO Environment.Variables.Message.Data.Details;
 
 
SET outdtlref .BOL = '';
 
SET outdtlref .Address = ''; | 
   
 
 
 
Here the problem is Details folder creating. But the fields in this folder not populating? | 
   
 
 
 
OK so your stuff hanging off the Environment.Variables has no parser defined...  This is your first error. Read up in the infocenter and on the forum on how to assign a parser to your Environment tree.
 
 
   
	| Code: | 
   
  
	DECLARE outdtlref REFERENCE TO Environment.Variables.Message.Data.Details;
 
 
SET outdtlref .BOL = ''; | 
   
 
 
You do not check whether the reference is valid after creating it.
 
You should have 
 
   
	| Code: | 
   
  
	DECLARE outdtlref REFERENCE TO Environment.Variables.Message.Data.Details;
 
 
IF LASTMOVE(outdtlref) THEN
 
   SET outdtlref.BOL = '';
 
   ....
 
END IF;
 
 | 
   
 
 
 
If you do not want to check the validity of the reference you need to make it valid before declaring it
 
   
	| Code: | 
   
  
	
 
SET Environment.Variables.Message.Data.Details VALUE = NULL;
 
DECLARE outdtlref REFERENCE TO Environment.Variables.Message.Data.Details;
 
 | 
   
 
 
 
And finally there should be no space between outdtlref and the field separator ('.')
 
 
Have fun   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | tanishka | 
		  
		    
			  
				 Posted: Thu Oct 28, 2010 5:21 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 24 Nov 2008 Posts: 144
  
  | 
		  
		    
			  
				Please see complete code.. and not getting fields in Details
 
 
CREATE LASTCHILD OF Environment.Variables.Msg DOMAIN ('XMLNSC') Namespace ns NAME 'Message';
 
DECLARE InmsgRef TO Environment.Variables.Msg.ns:Message;
 
 
SET InmsgRef.Header.type = '';
 
SET InmsgRef.Header.source ='';
 
SET InmsgRef.Header.family = '';
 
SET InmsgRef.Data. NO= '';
 
SET InmsgRef.Data.supplier= '';
 
SET InmsgRef.Data.Buyer = '';
 
 
FOR InDtlRef AS InputRoot.MRM.Dtls[] DO
 
CREATE LASTCHILD OF Environment.Variables.Data NAME 'Details'; 
 
DECLARE outdtlref REFERENCE TO   Environment.Variables.Message.Data.Details; 
 
 
IF LASTMOVE(outdtlref ) THEN
 
 
SET outdtlref.BOL = '';
 
--
 
END IF; | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Thu Oct 28, 2010 5:38 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				| If you are taking a copy of the entire input message then you should be able to perform the copy using a single line of ESQL. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | tanishka | 
		  
		    
			  
				 Posted: Thu Oct 28, 2010 5:51 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 24 Nov 2008 Posts: 144
  
  | 
		  
		    
			  
				| I do not want complete input message.  There are some changes. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Thu Oct 28, 2010 5:55 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				After this line has been executed, which occurrence of 'Details' will outdtlref point at ? 
   
	| Code: | 
   
  
	| DECLARE outdtlref REFERENCE TO Environment.Variables.Message.Data.Details;  | 
   
 
 
Is there a way to copy the entire array of Details elements from InputRoot to the target without looping? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | inder | 
		  
		    
			  
				 Posted: Thu Oct 28, 2010 6:25 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 24 Mar 2003 Posts: 49 Location: USA 
  | 
		  
		    
			  
				Hi, 
 
 Are you getting all the Details record or only one.
 
 
   
	| Quote: | 
   
  
	FOR InDtlRef AS InputRoot.MRM.Dtls[] DO 
 
CREATE LASTCHILD OF Environment.Variables.Data NAME 'Details'; 
 
DECLARE outdtlref REFERENCE TO Environment.Variables.Message.Data.Details;  | 
   
 
 
 
with the above code,you end up creating reference to the first child of Environment.Variables.Message.Data i.e Environment.Variables.Message.Data[1]
 
 
You need to create refernce to the 
 
DECLARE outdtlref REFERENCE TO Environment.Variables.Message.Data.Details[n] where n is the loop count
 
 
Hope this helps | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | tanishka | 
		  
		    
			  
				 Posted: Sat Oct 30, 2010 5:00 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 24 Nov 2008 Posts: 144
  
  | 
		  
		    
			  
				Hi,
 
 
 Thanks for all your suggestions.
 
 
finally this code worked.
 
 
DECLARE Msgref REFERENCE TO Environment.Variables.Message.Data;
 
CREATE LASTCHILD OF Environment.Variables.Message.Data AS Dtlref NAME 'Details'; | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |