Posted: Mon May 17, 2004 2:37 am Post subject: Encoding null
Voyager
Joined: 13 Oct 2003 Posts: 88
Hi all,
I am working with TDS messages (all fields are fixed length). If a field containing a date is not populated it should have a default value of spaces. The type of these fields is 'date'. I need to to this for both incoming and outgoing messages.
I have read that this could be done setting 'Encoding null' property to 'NullLiteralValue' and 'Encoding null value' to spaces. Unfortunately it is not working.
Are you on V5 or V2.1 ?
On V5 make sure you have set the nilable logical property on the element.
On v2.1 make sure you have added a null permitted value to the element (can't remember how to this but if you're on 2.1 I'll try and remember).
Null handling is for fields which have a logical value of NULL., or you want to be treated as if they had a value of NULL.
In TDS you cannot treat a field which is missing as NULL.
I assume you have a field which is missing in the message tree but you want to be written out in the output bitstream ?
If you are using TDS Fixed Length (which I think you said you were) then you should be using the default value functionality instead of null handling.
On an elements logical properties is a "Default Value" property. If you set this to your desired value (which has be the correct length) then if the field is completely missing on output it will be filled in.
In my last post I suggested using default value functionality.
However in your scneario where you have a date field and want it to default to all spaces then you cannot do this as the default value must be a valid logical value for the datatype of the element.
All spaces is not a valid logical value for a date field.
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