Function Name |
False | ||
Category |
Logic | ||
Icon |
![]() |
||
Description |
A boolean false value | ||
Inputs |
|
||
Outputs |
|
||
Properties |
|
The Data Mapper Logic False component allows you to feed a literal boolean value directly into your Mapping functions and output. Since the False function outputs a boolean, you may also use it in conjunction with other functions in the Set, Logic and Comparator categories. To apply the Logic False function, use the following process:
Create a new Data Mapper file, dragging your XML data source and targets into the editor area. For this example we are using staff_source.xsd, an XML Schema Definition inferred from the following source:
Source XML |
Copy Code
|
---|---|
<staff> <employee> <first_name>Mark</first_name> <second_name>Brown</second_name> <started>2001</started> <permanent>true</permanent> </employee> <employee> <first_name>Jane</first_name> <second_name>Jackson</second_name> <started>1998</started> <permanent>true</permanent> </employee> <employee> <first_name>Joe</first_name> <second_name>Simpson</second_name> <started>2008</started> <permanent>false</permanent> </employee> <employee> <first_name>Lynn</first_name> <second_name>Nicolson</second_name> <started>1999</started> <permanent>false</permanent> </employee> </staff> |
For our target schema we will be using staff_alt_target.xsd, inferred from the following XML:
Target XML |
Copy Code
|
---|---|
<company> <staff_member since="2000" contract="false" certified="true"> <f_name>Ken</f_name> <s_name>Jones</s_name> </staff_member> <staff_member since="2003" contract="true" certified="false"> <f_name>Linda</f_name> <s_name>Lee</s_name> </staff_member> <staff_member since="1998" contract="false" certified="true"> <f_name>Paul</f_name> <s_name>Mitchell</s_name> </staff_member> </company> |
The data models employees within an organisation. Notice that the target data model contains a value that is not in the source: the "certified" attribute of the "staff_member" element, representing some sort of work-related certification status. Let's assume that we are mapping data records for employees we know are not certified, perhaps due to which department they are in or where the data has been retrieved from. This means that we know all records should be output with a value of false for the attribute, and can use the False component to define this. Here is the Data Mapper with Source and Target imported:
Drag the Logic False function from the Component Palette into the mapping area:
The False component has no inputs, and a single output which is always a boolean false value. The output of the False function may be connected to items in the XML Writer or other components in the Mapper.
Connect the output of the False function to the "certified" input in the XML Writer.
Now each boolean value in the "certified" element will be false for the data being mapped. Finally let's make the remaining input and output connections.
We can now execute the transform by pressing Shift-F5 or the Execute button (). The transform is applied and the file we selected as output opens in the editor:
Output XML |
Copy Code
|
---|---|
<company> <staff_member since="2001" contract="true" certified="false"> <f_name>Mark</f_name> <s_name>Brown</s_name> </staff_member> <staff_member since="1998" contract="true" certified="false"> <f_name>Jane</f_name> <s_name>Jackson</s_name> </staff_member> <staff_member since="2008" contract="false" certified="false"> <f_name>Joe</f_name> <s_name>Simpson</s_name> </staff_member> <staff_member since="1999" contract="false" certified="false"> <f_name>Lynn</f_name> <s_name>Nicolson</s_name> </staff_member> </company> |
The output contains the input data plus a false value for each staff member "certified" attribute.