This scenario describes how to create a simple Schema, and describes how to use it in a Port or Workflow.
Customer1,Product1,10
Customer1,Product2,0
Customer2,Product1,100
Customer2,Product2,100
...
Create a new Schema. In the editor, select the Schema root in the tree control, and set Is Flat File Schema to true in the Properties pane. Right click on the Schema root in the tree control, and select Create Child Element. Rename this element to Root. Right click on the Root element, and select Create Child Complex Type. Rename this to Record. In the Properties pane, set the Delimiter to {CRLF} from the drop-down. This sets a carriage return / linefeed to be the record delimited (although the default Schema setting of IgnoreCarriageReturns=true will tolerate inconsistencies in the newline format). Set the DelimitMode to Infix_ToleratePostfix. This means that we don’t care whether or not the file finished with a new line. Set MaxContentOccurs to unbounded from the drop-down. This means that there can be multiple instances of the child items. Click on the Record element, and set the Delimiter to , (comma) in the Properties pane. This means that child items of this record will be comma separated. Right click in the Record element and create three child elements in turn, named CustomerId, ProductId, Quantity. Set the data-type of the Quantity element to be xs:int in the Properties pane. Now we can create a sample flat-file document by using the Tools | Generate Sample FlatFile Document menu item.int age = this.PersonMessage.BodyModel.Person.Age; (C#)
ordim age as System.Int32
age = Me.PersonMessage.BodyModel.Person.Age; (VB.Net)
Note that if the document is blank or the area of the document you are accessing does not exist, you may get null returned. You can create null areas of the document using the new (New) operator.