Author |
Message
|
catwood2 |
Posted: Mon Jun 14, 2004 2:21 pm Post subject: MRM: Setting Integer element to allow nulls |
|
|
Centurion
Joined: 17 May 2002 Posts: 108
|
Hi,
WMQI 2.1 CSD6
Can I set an message element, that is defined as an integer type, to allow nulls?
It is defaulting nulls to "0" on output. I can understand why - but not sure if there is a way I can tweak that. The only null property I see is on the message set itself ("Default Null Value Permitted") and even after going thru the Working with Messages manual having difficulty figuring out what that property does.
Tried setting the nillable attribute in the schema imported...no luck.
thoughts appreciated. |
|
Back to top |
|
 |
bpugh |
Posted: Tue Jun 15, 2004 5:21 am Post subject: |
|
|
Novice
Joined: 27 Apr 2004 Posts: 24 Location: St. Louis, MO
|
Have you tried setting the Padding Character to "NUL"? I'm using the V5.0.2 toolkit and when I click on an element in a message set, then click on Properties, underneath Physical Properties click on Local Element and you can change the padding character to zeros, spaces, or null. Might be worth a shot. This has helped me out in the past.
Bob |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jun 15, 2004 11:46 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You don't say what your output format is - I'll assume that it is XML.
XML null handling is controlled at the Message Set level. You need to go to the XML properties of the message set, and set the 'Encoding Numeric Null' and 'Encoding Numeric Null Value' properties. When the element's value matches the value in 'Encoding Numeric Null Value' it will do whatever you have said in the 'Encoding Numeric Null' option...but you don't say what you want to see on the output, so I can't be more specific than that.
You will also need to add a 'Null Permitted' value constraint to each nullable element in your model, or else set the 'Default Null Permitted' flag on the message set. |
|
Back to top |
|
 |
catwood2 |
Posted: Tue Jun 15, 2004 2:00 pm Post subject: |
|
|
Centurion
Joined: 17 May 2002 Posts: 108
|
Thanks for the pointers.
Output format is XML.
The desire is that when empty tags passed thru flow that they remain empty for certain elements on output. Currently, the integer tags are being populated:
Incoming Tag:
Code: |
<RequestorSeverity></RequestorSeverity> |
Output Message Tag:
Code: |
<RequestorSeverity>0</RequestorSeverity> |
and I would like
Code: |
<RequestorSeverity></RequestorSeverity> |
I went to the MessageSet level and attempted to set the properties on the XML tab for Null Encoding as recommended. I went to 'Working with Messages' manual to attempt to get a feel for how to populate. Didn't get much of a feel and also noticed that each of those property descriptions ended with the line:
Quote: |
(This property is reserved for future use.) |
Is my version an issue (WMQI2.1 csd6)?
Maybe my attempt at configuring:
MessageSet XML Tab
Encoding Null Num: NullElement
Encoding Null Num Value: xsi:nil
MessageSet Tab
Default Null Permitted at No
Element level:
Added value constraint of null permitted to the elements in question.
Thanks for any thoughts. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 16, 2004 8:01 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Don't hold me to this, but I think this is what you need. Give it a try, and let me know what happened:
Encoding Null Numeric : NullEmpty
Encoding Null Numeric Value : Not applicable
This should mean that when the input tags are empty, the value of the node (not the node itself) is set to null by the parser. On output, that null value in the tree will be written to the output bitstream as empty tags.
If you find that your output tree contains '0' (zero) rather than null, perhaps because your message flow has changed the tree, use
Encoding Null Numeric : NullValue
Encoding Null Numeric Value : 0
Your use of the NullPermitted value constraint is correct. |
|
Back to top |
|
 |
catwood2 |
Posted: Wed Jun 16, 2004 8:40 am Post subject: |
|
|
Centurion
Joined: 17 May 2002 Posts: 108
|
Kimbert-
Thanks! Indeed that did the trick. Greatly appreciate it! |
|
Back to top |
|
 |
catwood2 |
Posted: Thu Jun 17, 2004 8:38 am Post subject: |
|
|
Centurion
Joined: 17 May 2002 Posts: 108
|
As I am going thru some testing of MRM validation, I am wondering why the parser didn't choke on the empty elements? If null was not permitted - shouldn't this have generated an exception when validation was performed? And, of course, I have some elements where I am trying to do that - get a parser error when an element is null.
I did make an attempt by providing the Null Permitted constraint to the element and setting the value to 'false'....but, I don't think i'm grasping these properties when creating the constraint....off to do some more reading. |
|
Back to top |
|
 |
catwood2 |
Posted: Thu Jun 17, 2004 10:41 am Post subject: |
|
|
Centurion
Joined: 17 May 2002 Posts: 108
|
Well, I can generate the exception if I place a MinLength constraint of 1 on the element...but it still seems the Null settings are not working (or, likely, brain not grasping)? |
|
Back to top |
|
 |
|