Leth
Leth

Reputation: 1059

Empty decimal tag won't accept '' value, is invalid according to its datatype

I am getting this error when testing a map:

The value '' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:decimal' - The string '' is not a valid Decimal value.

The tag "LineAmount" is present in the input file, but is empty. I've tried making a "IsBlank" check before outputting the value, but it gives me the same error. The tag is optional and it should be possible not to include a value. Is it not possible to send en empty decimal tag in XSLT?

This is the tag in question:

<LineAmount/>

Upvotes: 0

Views: 923

Answers (2)

DTRT
DTRT

Reputation: 11040

So, the error is correct as '' (empty string) is not a valid Decimal.

The first thing you need to do is determine exactly what the destination value should be, specifically, 0 or not appear at all.

If the destination should always appear and be 0 if the source is empty, you will need to use a Scripting Functoid with a TryParse().

If the destination field should not appear if the source is empty, you can suppress the destination with some Functoids. For example:

Source -> Equal (Source & '') -> Logical Not -> Target

This means only include the target if the source is not ''. You will still link for the value separately.

Upvotes: 1

felixmondelo
felixmondelo

Reputation: 1474

You should use a "Value Mapping" functoid to link or not link the LineAmount.

The first argument should be a boolean value that says if the field has value and the second parameter, the LineAmount itself.

Upvotes: 0

Related Questions