Tuesday, 21 June 2016

How to set NULL value to nillable element in TIBCO?


How to set NULL value to nillable element in TIBCO?

Scenario: I had nillable element of type datetime. I needed to set value only when incoming value was datetime, otherwise I had to send null.

Sample XSD:

<?xml version="1.0" encoding="UTF-8"?>

 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

             xmlns="http://www.tibco.com/schemas/FunctionsTest/Schema.xsd3"

             targetNamespace="http://www.tibco.com/schemas/FunctionsTest/Schema.xsd3"

             elementFormDefault="qualified"

             attributeFormDefault="unqualified">

            <xs:element name="empStatus">

                        <xs:complexType>

                                    <xs:sequence>

                                                <xs:element name="Status" type="xs:dateTime" nillable="true" minOccurs="0"/>

                                    </xs:sequence>

                        </xs:complexType>

            </xs:element>

</xs:schema>

 


 

Solution:

Input Request:


 

  • Right click on element and select: Statement->Surround with Choice
  • Select 1 when condition and otherwise
  • In when condition should be something like this: string-length(value)>0
  • If condition is true -> insert value
  • Click on the element in otherwise section and select “!” in menu. Then: Content->Set explicit Nil


 

Test Results:

Input: with NULL value


Output:


 

Input: with value


Output:

1 comment: