Default empty field value

These examples show transformations that use empty field values. When a field is empty, the value to write is defined using the default empty field value.

Flat to XML with Empty Fields

This example shows an input flat file that is field-separated with some empty fields. The generated XML output is substituted with the default empty value.

Flat File Definition:

<BankRepository>
	<Files>
		<File>
			<ID>SampleSeven</ID>
			<Messages>
				<Message>
               <IgnorePrecedingFieldSeparator>0</IgnorePrecedingFieldSeparator>
               <DefaultEmptyFieldValue>
                  <Numeric>0</Numeric>
                  <Alpha>X</Alpha>
                </DefaultEmptyFieldValue>
                <DefaultAlignment>
                  <Numeric>RIGHT</Numeric>
                  <Alpha>LEFT</Alpha>
                </DefaultAlignment>
                <DefaultPadding>
                  <Numeric>0</Numeric>
                  <Alpha> </Alpha>
                </DefaultPadding>
                <DefaultTrim>
                  <Numeric>1</Numeric>
                  <Alpha></Alpha>
                </DefaultTrim>
					<Name>TopNode</Name>
					<TagName>TopNode</TagName>										
					<EscapeChar/>
					<RecordSeparator>\n</RecordSeparator>
					<FieldSeparator>:</FieldSeparator>
					<Records>
						<Record>
							<Name>RecordOne</Name>
							<TagName>RecordOne</TagName>
							<MinOccur>1</MinOccur>
							<MaxOccur>0</MaxOccur>
							<Fields>
								<Field>
									<Name>Field1</Name>
									<TagName>Field1</TagName>
									<DataType>Alpha</DataType>
									<PaddingChar/>
									<DecimalLength/>
									<Alignment>LEFT</Alignment>
									<StartPos>0</StartPos>
									<Length>0</Length>
									<DefaultValue></DefaultValue>
									<Identifier>0</Identifier>
								</Field>
								<Field>
									<Name>Field2</Name>
									<TagName>Field2</TagName>
									<DataType>Alpha</DataType>
									<PaddingChar/>
									<DecimalLength/>
									<Alignment>LEFT</Alignment>
									<StartPos>0</StartPos>
									<Length>0</Length>
									<DefaultValue></DefaultValue>
									<Identifier>0</Identifier>
								</Field>
							</Fields>
						</Record>
					</Records>
				</Message>
			</Messages>
		</File>
	</Files>
</BankRepository>

Input file:

a:b:
c::
::
:d:
e:f:

The expected result is:

<TopNode>
       <RecordOne>
             <Field1>a</Field1>
              <Field2>b</Field2>
       </RecordOne>
       <RecordOne>
              <Field1>c</Field1>
              <Field2>X</Field2>
        </RecordOne>
        <RecordOne>
              <Field1>X</Field1>
              <Field2>X</Field2>
        </RecordOne>
        <RecordOne>
              <Field1>X</Field1>
              <Field2>d</Field2>
        </RecordOne>
        <RecordOne>
               <Field1>e</Field1>
               <Field2>f</Field2>
        </RecordOne>
</TopNode>

XML to Flat with Empty Fields

This example shows an input XML file with empty content for some fields. The generated flat file output is substituted with the default empty value. When writing fixed-length flat files, the alignment and padding must be defined because the empty field value is aligned and padded to fill the specified length.

Flat File Definition:

<BankRepository>
	<Files>
		<File>
			<ID>SampleSeven</ID>
			<Messages>
				<Message>
               <IgnorePrecedingFieldSeparator>0</IgnorePrecedingFieldSeparator>
               <DefaultEmptyFieldValue>
                  <Numeric>0</Numeric>
                  <Alpha>X</Alpha>
                </DefaultEmptyFieldValue>
                <DefaultAlignment>
                  <Numeric>RIGHT</Numeric>
                  <Alpha>LEFT</Alpha>
                </DefaultAlignment>
                <DefaultPadding>
                  <Numeric>0</Numeric>
                  <Alpha> </Alpha>
                </DefaultPadding>
                <DefaultTrim>
                  <Numeric>1</Numeric>
                  <Alpha></Alpha>
                </DefaultTrim>
					<Name>TopNode</Name>
					<TagName>TopNode</TagName>										
					<EscapeChar/>
					<RecordSeparator>\n</RecordSeparator>
					<FieldSeparator>:</FieldSeparator>
					<Records>
						<Record>
							<Name>RecordOne</Name>
							<TagName>RecordOne</TagName>
							<MinOccur>1</MinOccur>
							<MaxOccur>0</MaxOccur>
							<Fields>
								<Field>
									<Name>Field1</Name>
									<TagName>Field1</TagName>
									<DataType>Alpha</DataType>
									<PaddingChar/>
									<DecimalLength/>
									<Alignment>LEFT</Alignment>
									<StartPos>0</StartPos>
									<Length>0</Length>
									<DefaultValue></DefaultValue>
									<Identifier>0</Identifier>
								</Field>
								<Field>
									<Name>Field2</Name>
									<TagName>Field2</TagName>
									<DataType>Alpha</DataType>
									<PaddingChar/>
									<DecimalLength/>
									<Alignment>LEFT</Alignment>
									<StartPos>0</StartPos>
									<Length>0</Length>
									<DefaultValue></DefaultValue>
									<Identifier>0</Identifier>
								</Field>
							</Fields>
						</Record>
					</Records>
				</Message>
			</Messages>
		</File>
	</Files>
</BankRepository>

Input File:

<Record>
     <FieldOne>a</FieldOne>
     <FieldTwo>b</FieldTwo>
</Record>
<Record>
     <FieldOne/>
     <FieldTwo/>
</Record>
<Record>
     <FieldOne>c</FieldOne>
     <FieldTwo/>
</Record>
<Record>
     <FieldOne/>
     <FieldTwo>d</FieldTwo>
</Record>
<Record>
     <FieldOne>e</FieldOne>
     <FieldTwo>f</FieldTwo>
</Record>

The expected result is:

a:b: 
X:X: 
c:X: 
X:d: 
e:f: