Liquid XML Studio
See Also Send Feedback
Data Mapping > Data Mapper Functions > By Category > Logic > True

Glossary Item Box

Function Name
A boolean true value
None -
Result A constant boolean value of true
None -


The Data Mapper Logic True component allows you to feed a literal boolean value directly into your Mapping functions and output. Since the True 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 True 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

For our target schema we will be using staff_alt_target.xsd, inferred from the following XML:

Target XML Copy Code
 <staff_member since="2000" contract="false" certified="true">
 <staff_member since="2003" contract="true" certified="false">
 <staff_member since="1998" contract="false" certified="true">

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 all 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 true for the attribute, and can use the True component to define this. Here is the Data Mapper with Source and Target imported:

Data Mapper Source and Target

Drag the Logic True function from the Component Palette into the mapping area:

True Component

True Added

The True component has no inputs, and a single output which is always a boolean true value. The output of the True function may be connected to items in the XML Writer or other components in the Mapper.

Connect the output of the True function to the "certified" input in the XML Writer.

True Mapped

Now each boolean value in the "certified" element will be true for the data being mapped. Finally let's make the remaining input and output connections.

Inputs and Outputs Connected

We can now execute the transform by pressing Shift-F5 or the Execute button (Execute). The transform is applied and the file we selected as output opens in the editor:

Output XML Copy Code
 <staff_member since="2001" contract="true" certified="true">
 <staff_member since="1998" contract="true" certified="true">
 <staff_member since="2008" contract="false" certified="true">
 <staff_member since="1999" contract="false" certified="true">

The output contains the input data plus a true value for each staff member "certified" attribute.

See Also