Author |
Message
|
ydeonia |
Posted: Wed Jan 30, 2013 8:05 pm Post subject: How do I set default value to NULL |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
Hi
I am using MRM parser and getting some values in NULL sometimes. I want to set the default value to NULL if I get them. I have made the changes to message set as 0 and checked the nillable . but its not working . I am getting 0 as the default value even I get the blank in input message.
In code
IF inref."ABSO_COL1_I" IS NULL OR inref."ABSO_COL1_I" = '0'THEN
SET outref."ABSO_COL1_O" = NULL ;
ElSE SET outref."ABSO_COL1_O" = inref."ABSO_COL1_I" ;
END IF;
But when I don't set default 0 in message set it throws exception and otherwise it takes 0 . Please help in this . |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 30, 2013 8:22 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
This will in fact remove the tag...
Code: |
SET ref VALUE = NULL; |
This keeps the tag (needs to be nillable) and sets it's value to null  _________________ MQ & Broker admin |
|
Back to top |
|
 |
ydeonia |
Posted: Wed Jan 30, 2013 8:45 pm Post subject: |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
fjb_saper wrote: |
This will in fact remove the tag...
Code: |
SET ref VALUE = NULL; |
This keeps the tag (needs to be nillable) and sets it's value to null  |
Thanks for the reply but infact I want to remove it if its NULL . any other suggestion  |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jan 30, 2013 10:13 pm Post subject: Re: How do I set default value to NULL |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
ydeonia wrote: |
But when I don't set default 0 in message set it throws exception and otherwise it takes 0 . Please help in this . |
You can have this code in ESQL,
Code: |
IF inref."ABSO_COL1_I" IS NOT NULL AND inref."ABSO_COL1_I" <> '0'THEN
SET outref."ABSO_COL1_O" = inref."ABSO_COL1_I" ;
END IF;
|
And in the Message Set for this int element, just check the 'Nillable' property. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jan 31, 2013 4:53 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The default value is used to populate a logical value if the field is not specified in the physical message.
You appear to be wanting to not populate any value at all if the field is not specified in the physical message.
You need to determine if it is allowable that the field is not at all specified in the physical message - that is, if the field is *required*.
If the field is optional, then you don't need to do anything to make sure that you don't get a value if there isn't a value.
At a higher level, in any message transformation, if you do not want a field to appear in the output message, then simply *don't* set it. |
|
Back to top |
|
 |
ydeonia |
Posted: Wed Feb 06, 2013 7:24 pm Post subject: |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
mqjeff wrote: |
The default value is used to populate a logical value if the field is not specified in the physical message.
You appear to be wanting to not populate any value at all if the field is not specified in the physical message.
You need to determine if it is allowable that the field is not at all specified in the physical message - that is, if the field is *required*.
If the field is optional, then you don't need to do anything to make sure that you don't get a value if there isn't a value.
At a higher level, in any message transformation, if you do not want a field to appear in the output message, then simply *don't* set it. |
Thanks I made the fields optional and it worked ! Thank you |
|
Back to top |
|
 |
|