ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » TDS: keeping null fields in the logical tree

Post new topic  Reply to topic
 TDS: keeping null fields in the logical tree « View previous topic :: View next topic » 
Author Message
protocol7
PostPosted: Sat Dec 27, 2003 6:01 am    Post subject: TDS: keeping null fields in the logical tree Reply with quote

Novice

Joined: 27 Nov 2003
Posts: 13
Location: Göteborg, Sweden

I'm using TDS to parse a semi-colon delimited format, e.g:
field1;field2;field3

My problem is that fields can be empty, e.g:
field1;;field3

and the sequence and numbering of the fields is crucial for me. The parser will (correctly) threat the empty field as a null field and not create a node in the logical tree. But, in my ESQL I need to check the values of field based on their position (e.g. the second field) in the original file. This is currently impossible since there won't be any node created for the second field and the second node in the logical tree will actually contain the value of the third field.

Is there any way to configure the parser to create a node in the logical tree for an empty field? The node could for example contain an empty string.

Many thanks!
Niklas
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jefflowrey
PostPosted: Sat Dec 27, 2003 7:50 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Have you looked at default value constraints? Have you looked at the Null handling properties of elements?

Have you looked in the Working With Messages manual for information on working with null fields?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
protocol7
PostPosted: Sat Dec 27, 2003 8:06 am    Post subject: Reply with quote

Novice

Joined: 27 Nov 2003
Posts: 13
Location: Göteborg, Sweden

I have looked at default values, but for elements this is only used if the node exists but is empty. However, I just read that for attributes the node should be created. I will go ahead and see if that might solve the problem.

I also read the manual on null handling options and tried to configure the null handling to both NULLLogicalValue and NULLLiteralValue but with no luck. I didn't find anything else in the manual that helped me. I'm sure I'm missing something obvious so if I'm happy for any help!

Niklas
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
protocol7
PostPosted: Sat Dec 27, 2003 8:16 am    Post subject: Reply with quote

Novice

Joined: 27 Nov 2003
Posts: 13
Location: Göteborg, Sweden

I just tried using attributes but they are not allowed in All fields delimited TDS definitions.

Niklas
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jefflowrey
PostPosted: Sun Dec 28, 2003 6:48 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Sorry. I forgot that the Null handling stuff is for defining what characteristics of the physical message result in a Logical Null.

You should be able to use the FIELDNAME function to figure out if you're accessing the right field or otherwise preserve the right field when you're accessing the children by position.

Or, of course, you could just not access them by position, instead access them by name. Then you could directly check if Field2 is NULL, or whatever, without worrying if FIELDNAME(ParentField.*[2]) = 'Field2'.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
protocol7
PostPosted: Sun Dec 28, 2003 7:02 am    Post subject: Reply with quote

Novice

Joined: 27 Nov 2003
Posts: 13
Location: Göteborg, Sweden

Yeap, the reason why I'm accessing the nodes by position is that I also get a list of what fields have changed, as a list of positions. I'm only interested in the values that has changed. So I start of with reading the positions that have changed and then try to get the values for those fields by position. This fails now since the list of nodes is shifted as soon as there is a null field. I could keep a table that maps field names to positions in my ESQL but I would not like to since I want someone to makes changes to the message set only when the format is changed. The ESQL should not have to updated.

The fix I can think of now is to pre-process the incoming data and insert a space in the empty field. This way the parser will keep the node. But I can't belive that there isn't a more clever way of configuring the parser to keep empty nodes.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
kimbert
PostPosted: Tue Dec 30, 2003 12:34 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Are you sure that the Null Handling facilities cannot be used here?
You should be able to get a syntax element in the tree, with the value 'null'. (which is not the same as a null syntax element!). To do this, go to the TDS properties of the element, and set the property 'Encodng Null' to 'NullLiteralValue' and the property 'Encoding Null Value' to the empty string.

If this works, you should be able to access all the nodes by position with no problems.
Back to top
View user's profile Send private message
protocol7
PostPosted: Tue Dec 30, 2003 3:38 pm    Post subject: Reply with quote

Novice

Joined: 27 Nov 2003
Posts: 13
Location: Göteborg, Sweden

I've tried using that option but I simply fail to get it working :-/

I've uploaded a minimal implementation for WBIMB 5.0.2 that fails at http://www.protocol7.com/lab/nulltest.zip (Flow and MessageSet projects).

If anyone got some time to take a look at my example and see if you can find any problem I would be ever thankful!

Niklas
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
kimbert
PostPosted: Mon Jan 05, 2004 3:10 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I took a look at your message set. You need to set the 'Nillable' flag on the logical properties as well. Let me know if that works.
Back to top
View user's profile Send private message
protocol7
PostPosted: Mon Jan 05, 2004 5:58 am    Post subject: Reply with quote

Novice

Joined: 27 Nov 2003
Posts: 13
Location: Göteborg, Sweden

Perfect! Thanks, that works like a charm.

/niklas
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » TDS: keeping null fields in the logical tree
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.