Originally posted by: SystemAdmin
So you've been given a sow's ear and you're expected to make a silk purse of it? One way that will work, although it may be tedious if you have to do it for each field, is to create the field as a partitioned item containing two items one with double quotes for initiator and terminator and one without. Just make sure the name of the item with quotes precedes the one without quotes alphabetically as this is the order in which the partition will be evaluated.
Below is the export file of a type tree that will read in your data correctly:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE TTMAKER SYSTEM "ttmaker60.dtd">
<?ANALYZE?><TTMAKER Version="6.0"><NEWTREE Filename="C:\MercatorTips\CSVwithEmbeddedCommas.mtt"><ROOT SimpleTypeName="Data" SetUpProperties="DEFAULT" SetUpComponents="DELETE" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/></Sequence>
<CharTextWestern><Size Min="0" Max="S"/>
<Western CharSet="NATIVE"/>
<ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
</CharTextWestern>
</ROOT>
<ITEM SimpleTypeName="Field" CategoryOrItemParent="Data" partition="YES" OrderSubtypes="ASCENDING"><TypeSyntax><TERMINATOR><Literal IgnoreCase="NO"><Western CharSet="NATIVE"/>
<LiteralValue>,</LiteralValue>
</Literal>
</TERMINATOR>
</TypeSyntax>
<CharTextWestern><Size Min="0" Max="S"/>
<Western CharSet="NATIVE"/>
<ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
</CharTextWestern>
</ITEM>
<ITEM SimpleTypeName="QuotedField" CategoryOrItemParent="Field Data" partition="NO" OrderSubtypes="ASCENDING"><TypeSyntax><INITIATOR><Literal IgnoreCase="NO"><Western CharSet="NATIVE"/>
<LiteralValue>"</LiteralValue>
</Literal>
</INITIATOR>
<TERMINATOR><Literal IgnoreCase="NO"><Western CharSet="NATIVE"/>
<LiteralValue>"</LiteralValue>
</Literal>
</TERMINATOR>
</TypeSyntax>
<CharTextWestern><Size Min="0" Max="S"/>
<Western CharSet="NATIVE"/>
<ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
</CharTextWestern>
</ITEM>
<ITEM SimpleTypeName="UnQuotedField" CategoryOrItemParent="Field Data" partition="NO" OrderSubtypes="ASCENDING"><CharTextWestern><Size Min="0" Max="S"/>
<Western CharSet="NATIVE"/>
<ValueRestrictions IgnoreCase="NO" Rule="INCLUDE"></ValueRestrictions>
</CharTextWestern>
</ITEM>
<GROUP SimpleTypeName="File" CategoryOrGroupParent="Data" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>Record</RelativeTypeName>
<Range Min="1" Max="S"/>
</SequenceComponent>
</Sequence>
</GROUP>
<GROUP SimpleTypeName="Record" CategoryOrGroupParent="Data" OrderSubtypes="ASCENDING"><TypeSyntax><TERMINATOR><Literal IgnoreCase="NO"><Western CharSet="NATIVE"/>
<LiteralValue><NL></LiteralValue>
</Literal>
</TERMINATOR>
</TypeSyntax>
<Sequence partition="NO"><Explicit Track="Places"><Delimited location="INFIX"><DelimiterLiteral><Western CharSet="NATIVE"/>
<LiteralValue>,</LiteralValue>
</DelimiterLiteral>
</Delimited>
</Explicit>
<SequenceComponent><RelativeTypeName>Field</RelativeTypeName>
<Range Min="1" Max="S"/>
</SequenceComponent>
</Sequence>
</GROUP>
</NEWTREE>
</TTMAKER>
#IBMSterlingTransformationExtender#IBM-Websphere-Transformation-Extender#DataExchange