| Author | 
		  Message
		 | 
		
		  | edasnarik | 
		  
		    
			  
				 Posted: Sun Jun 28, 2009 11:01 pm    Post subject: Problem accessing value in Reference Variable | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 10 Mar 2009 Posts: 61
  
  | 
		  
		    
			  
				Hello All,
 
 
I have clicked on "Show Type Names" in the debug perspective and the structure in debug is as shown below.
 
 
   
	| Code: | 
   
  
	var1
 
   CHARACTER  @IdRef = yyy
 
     Some Free form Txt Value | 
   
 
 
 
If we have not clicked on "Show Type Names" the structure is as below.
   
	| Code: | 
   
  
	
 
var1
 
   @IdRef = yyy
 
     Some Free form Txt Value | 
   
 
 
I am placing this to only avoid any confusion caused.
 
 
To further avoid confusion I have place the image of debug here.
 
http://www.sendspace.com/file/9143e3
 
 
 
var1 is the reference variable.
 
IdRef is an attribute present
 
and the actual value which needs to be accessed is Some Free form Txt Value
 
 
I tried the FIELDVALUE function also but in vain.
 
 
Please help me in this regard.
  Last edited by edasnarik on Mon Jun 29, 2009 2:47 am; edited 3 times in total | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Mon Jun 29, 2009 1:29 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				Hi,
 
 
Looks as if the value is held in a child node of the attribute - but that's puzzling because 
 
a) none of the XML domains will create a child nodes for the value of an attribute. Not usually, anyway.
 
b) If they did create the value as a child node, FIELDVALUE should return the correct value anyway.
 
 
Please 
 
- tell us which domain you are using
 
- insert a Trace node and post the relevant fragment of the output
 
- post the fragment of XML which produced it | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | edasnarik | 
		  
		    
			  
				 Posted: Mon Jun 29, 2009 2:04 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 10 Mar 2009 Posts: 61
  
  | 
		  
		    
			  
				Input's Domain is MRM and Output's Domain is XMLNS.
 
 
   
	| Code: | 
   
  
	DECLARE contact admin  REFERENCE TO InputRoot.MRM.InsuranceSvcRs.PolicyInqRs.PolInfo.contact admin;
 
 
FOR refInRemarkText AS contact admin.RemarkText[]  DO 
 
DECLARE entireRemarksSec CHARACTER refInRemarkText||'~';
 
SET UnderWritingNotesDetails = UnderWritingNotesDetails || getRemarksTextInReqdFormat(entireRemarksSec)||'<br>'; 
 
END FOR;
 
 | 
   
 
 
 
Input XML for that Part is :
 
 
   
   
	| Code: | 
   
  
	</PersAutoLineBusiness>
 
     <RemarkText IdRef="yyy">8/27/08~Underwriter Decision Category: Cancel Cause~Underwriter Decision Reason: Nonpayment of Bill~Underwriter Decision comment:  Insured Contacted</RemarkText>
 
<RemarkText IdRef="yyy">7/27/2008~Underwriter Decision Category: Approve with Change~Underwriter Decision Reason: Driver Exclusion~Underwriter Decision comment:  Insured Contacted</RemarkText>
 
    </contact admin>
 
   </PolInfo>
 
  </PolicyInqRs>
 
 </InsuranceSvcRs>
 
</ACORD>
 
 | 
   
 
 
 
I am not getting any value in entireRemarksSec
 
 
Since the above code did not work as per requirement I tried to place refInRemarkText in another reference named var1 and whose debug is shown in my first post. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Tanesh | 
		  
		    
			  
				 Posted: Mon Jun 29, 2009 4:20 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 29 Jun 2009 Posts: 8
  
  | 
		  
		    
			  
				Well, your XML looks like this -
 
 
   
	| Quote: | 
   
  
	
 
Code: 
 
</PersAutoLineBusiness> 
 
     <RemarkText IdRef="yyy">8/27/08~Underwriter Decision Category: Cancel Cause~Underwriter Decision Reason: Nonpayment of Bill~Underwriter Decision comment:  Insured Contacted</RemarkText> 
 
<RemarkText IdRef="yyy">7/27/2008~Underwriter Decision Category: Approve with Change~Underwriter Decision Reason: Driver Exclusion~Underwriter Decision comment:  Insured Contacted</RemarkText> 
 
    </contact admin> 
 
   </PolInfo> 
 
  </PolicyInqRs> 
 
 </InsuranceSvcRs> 
 
</ACORD>
 
 
 | 
   
 
 
 
And your code looks like -
 
 
   
	| Quote: | 
   
  
	
 
 
DECLARE contact admin  REFERENCE TO InputRoot.MRM.InsuranceSvcRs.PolicyInqRs.PolInfo.contact admin; 
 
 
FOR refInRemarkText AS contact admin.RemarkText[]  DO 
 
DECLARE entireRemarksSec CHARACTER refInRemarkText||'~'; 
 
SET UnderWritingNotesDetails = UnderWritingNotesDetails || getRemarksTextInReqdFormat(entireRemarksSec)||'<br>'; 
 
END FOR; | 
   
 
 
 
As per the XML, it seems you have <ACORD> element in the incoming message which you have not included while declaring the reference. Please try including the element.[/quote] | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | edasnarik | 
		  
		    
			  
				 Posted: Mon Jun 29, 2009 4:54 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 10 Mar 2009 Posts: 61
  
  | 
		  
		    
			  
				I am accessing in the right way only.
 
If I include the ACORD also, it is going to be entire root i.e., properties MQMD and then message. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vmcgloin | 
		  
		    
			  
				 Posted: Mon Jun 29, 2009 5:32 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Knight
 
 Joined: 04 Apr 2002 Posts: 560 Location: Scotland 
  | 
		  
		    
			  
				So where did you try FIELDVALUE? FIELDVALUE(refInRemarkText)? 
 
 
Also, I don't know if it is a good idea to have your DECLARE in the FOR loop. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | edasnarik | 
		  
		    
			  
				 Posted: Mon Jun 29, 2009 6:07 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 10 Mar 2009 Posts: 61
  
  | 
		  
		    
			  
				First let me think of a working code and then I can go for performance.
 
 
I copied the refInRemarkText to another reference like this
 
   
	| Code: | 
   
  
	| DECLARE var1 REFERENCE TO refInRemarkText; | 
   
 
 
 
and since var1 had values like in the first post I tried to use FIELDVALUE over there i.e.,
 
 
 
Off course with a valid correlation name. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vmcgloin | 
		  
		    
			  
				 Posted: Mon Jun 29, 2009 6:48 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Knight
 
 Joined: 04 Apr 2002 Posts: 560 Location: Scotland 
  | 
		  
		    
			  
				Hi,
 
 
I was not thinking of performance, I was just thinking the concatenation would not work, but I see what you are trying to do now...  I stand by the idea that FIELDVALUE(refInRemarkText) should give you the text you wanted.
 
 
Why don't you try the middle thing that kimbert suggested?
 
- insert a Trace node and post the relevant fragment of the output 
 
Would it help to post a trace of the input too?
 
 
(I can't access the jpeg you posted so that does not help.)
 
 
Cheers,
 
Vicky | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Jun 30, 2009 12:28 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				Please explain why you are parsing your input XML using MRM XML, but writing the output message using XMLNS.
 
 
   
	| Quote: | 
   
  
	Why don't you try the middle thing that kimbert suggested?
 
- insert a Trace node and post the relevant fragment of the output
 
Would it help to post a trace of the input too?  | 
   
 
 
Please put the Trace node immediately before the Compute node.
 
 
If you still cannot see what is going wrong, please take a user trace  - the answer will almost certainly be in there somewhere. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | edasnarik | 
		  
		    
			  
				 Posted: Tue Jun 30, 2009 5:07 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 10 Mar 2009 Posts: 61
  
  | 
		  
		    
			  
				I could not figure out anything with the trace.
 
Enclosed is the part of the input trace.
 
 
   
	| Code: | 
   
  
	            )
 
            (0x01000013):RemarkText           = (
 
              (0x0300000D):@IdRef = 'yyy'
 
              (0x0200000B):       = '8/27/08~Underwriter Decision Category: Cancel Cause~Underwriter Decision Reason: Nonpayment of Bill~Underwriter Decision comment:  Insured Contacted'
 
            )
 
            (0x01000013):RemarkText           = (
 
              (0x0300000D):@IdRef = 'yyy'
 
              (0x0200000B):       = '7/27/2008~Underwriter Decision Category: Approve with Change~Underwriter Decision Reason: Driver Exclusion~Underwriter Decision comment:  Insured Contacted'
 
            )
 
          )
 
        )
 
      )
 
    )
 
 | 
   
 
 
 
The output Trace for this element is blank. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Jun 30, 2009 5:17 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				- You did not answer my question 'why MRM XML on input?'
 
- Your attribute @IdRef is not modeled correctly - that's why the MRM parser has put a '@' at the start of the name. Not necessarily a problem, but I'm just saying...
 
- User trace will tell you why the output element is blank. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | edasnarik | 
		  
		    
			  
				 Posted: Tue Jun 30, 2009 5:28 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 10 Mar 2009 Posts: 61
  
  | 
		  
		    
			  
				
   
	| kimbert wrote: | 
   
  
	-  'why MRM XML on input?'
 
 | 
   
 
 
It is an acord message set. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Jun 30, 2009 5:31 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				That is a fact, not a justification for your design.
 
Why does that fact make it a good idea to use MRM XML on input, but XMLNS on output? And why not use XMLNSC for both? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | edasnarik | 
		  
		    
			  
				 Posted: Fri Jul 03, 2009 2:06 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 10 Mar 2009 Posts: 61
  
  | 
		  
		    
			  
				It was a problem with accessing mixed element.
 
It is solved now with the syntax as below.
 
   
	| Code: | 
   
  
	DECLARE entireRemarksSec CHARACTER refInRemarkText.*[<1] ||'~';
 
 | 
   
 
 
 
Thanks to all of you .. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |