| Author | Message | 
		
		  | pcelari | 
			  
				|  Posted: Thu Mar 15, 2007 5:44 am    Post subject: field with nothing in question |   |  | 
		
		  | Chevalier
 
 
 Joined: 31 Mar 2006Posts: 411
 Location: New York
 
 | 
			  
				| a field in my tree could be empty, 
 <myDataTree>
 <itemCode/>
 <itemName>iPod<itemName>
 <myDataTree>
 
 in such case, I need to populate a variable with default value '999'.
 
 I tried the following:
 declare c char InputBody.myDataTree.itemCode;
 
 if c = NULL then
 set c = '999';
 end if;
 
 Nor does it work with
 
 if length(c) = 0 then
 set c = '999';
 end if;
 
 nor
 if c = '' then
 set c = '999';
 end if;
 
 So, what should I use to accomplish this? What is c in such case? It must be sth trivial, what am I missing?
 
 thanks for any insight!
 _________________
 pcelari
 -----------------------------------------
 - a master of always being a newbie
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Vitor | 
			  
				|  Posted: Thu Mar 15, 2007 5:47 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 11 Nov 2005Posts: 26093
 Location: Texas, USA
 
 | 
			  
				| I would try something like: 
 
 
   
	| Code: |  
	| IF InputBody.myDataTree.itemCode IS NULL THEN
 SET c = '999';
 END IF;
 
 |  
 Code from memory, untested, use at your own risk, etc, etc...
 _________________
 Honesty is the best policy.
 Insanity is the best defence.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | special_agent_Queue | 
			  
				|  Posted: Thu Mar 15, 2007 5:57 am    Post subject: |   |  | 
		
		  |  Centurion
 
 
 Joined: 27 Jul 2006Posts: 102
 
 
 | 
			  
				| What domain are you using? 
 In XMLNSC, I've found that checking the FIELDTYPE of an element is more reliable than checking it for null, etc.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | pcelari | 
			  
				|  Posted: Thu Mar 15, 2007 6:22 am    Post subject: |   |  | 
		
		  | Chevalier
 
 
 Joined: 31 Mar 2006Posts: 411
 Location: New York
 
 | 
			  
				| thanks a lot for the insight, it works. But I prefer to test the content of c after the assignment. 
 I use MRM.
 
 in my case what is the content of c after the statement below?
 
 set c = InputBody.myDataTree.itemCode;
 
 thanks,
 _________________
 pcelari
 -----------------------------------------
 - a master of always being a newbie
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kimbert | 
			  
				|  Posted: Thu Mar 15, 2007 6:28 am    Post subject: |   |  | 
		
		  |  Jedi Council
 
 
 Joined: 29 Jul 2003Posts: 5543
 Location: Southampton
 
 | 
			  
				| What does the Trace node say? |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | broker_new | 
			  
				|  Posted: Sat Mar 24, 2007 10:06 am    Post subject: |   |  | 
		
		  |  Yatiri
 
 
 Joined: 30 Nov 2006Posts: 614
 Location: Washington DC
 
 | 
			  
				| As you are using InputBody there is no need of using the myDataTree you can code directly as InputBody.itemCode here. 
 IF InputBody.itemCode IS NULL THEN
 SET c = '999';
 END IF;
 _________________
 IBM ->Let's build a smarter planet
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | elvis_gn | 
			  
				|  Posted: Sat Mar 24, 2007 1:23 pm    Post subject: |   |  | 
		
		  |  Padawan
 
 
 Joined: 08 Oct 2004Posts: 1905
 Location: Dubai
 
 | 
			  
				| Hi pcelari, 
 
  Maybe you should use 
	| pcelari wrote: |  
	| thanks a lot for the insight, it works. But I prefer to test the content of c after the assignment. 
 I use MRM.
 
 in my case what is the content of c after the statement below?
 
 set c = InputBody.myDataTree.itemCode;
 
 thanks,
 |  Regards.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Sun Mar 25, 2007 5:14 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| And you did not try anything like IF c VALUE IS NULL ???
 
 IF c is null -- wouldn't that mean that c did not exist on the part that the assignment did?
 
 You could as well try a  ref.. check that the assignment is correct by using Lastmove(ref) and then copy the assignment to c.
 
 Then you should be able to test the VALUE of your ref.
 
 Enjoy
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | maanav_kr | 
			  
				|  Posted: Tue Mar 27, 2007 6:38 pm    Post subject: |   |  | 
		
		  |  Novice
 
 
 Joined: 19 Jan 2007Posts: 15
 
 
 | 
			  
				| am trying to achieve something very close to current issue. I have to validate messages which may have blank tags.. or tags may be missing. Domain is XMLNSC. Their are few tags which could be a field and there are few of type folder 
 I am creating reference to the tag
 
 
 
   
	| Code: |  
	| DECLARE ABCRef REFERENCE to InputRoot.XMLNSC.NS1:abc; 
 declare ft_anc integer   FIELDTYPE(ABCRef);
 |  
 but am not getting dependable output.
 
 
 
   
	| Code: |  
	| IF NOT (LastMove(ABCRef)) THEN set Environment.abc_NULL= 'TRUE';
 ELSEIF FIELDTYPE(ABCRef) IS NULL THEN
 set Environment.abc_NULL= 'TRUE';
 ELSEIF ft_abc = XMLNSC.Field THEN
 set Environment.abc_NULL= 'TRUE';
 ELSEIF ft_abc = XMLNSC.Folder THEN
 set Environment.abc_NULL= 'TRUE';
 else
 set Environment.abc_NULL= 'FALSE';
 end if;
 |  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |