问题
I need to create a Flat file schema out of a .csv file having repeated lines:
#Constant
#Date: 1.1.1999
Type1;xxx;yyy;zzz;aaa;bbb
Type2;xxx;yyy;zzz;aaa;bbb
Type3;xxx;yyy;zzz;aaa;bbb
0;123;222;333;444
1;1;22;333;2;22
1;2;33;22;2;22
1;;;33;3;33
2;100;22;1;222;11;22
0;23;22;33;44
1;2;11;22;11;22
1;22;11;22;22;33
0;23;22;55;66
1;22;11;22;66;77
As you can see the rows of type 0,1 and 2 are repeating.
I tried to create flat file considering #Constant till Type3 as field elements and 0,1,2 rows as repeating records with their respective tag identifiers. But since these rows are repeating , i am getting error while validating schema instance.
回答1:
You can create the schema using the flat file schema wizard and some manual modification.
Start with the wizard.
First create the schema for the repeating part: select the first block of lines 0,1,1,1,2, leave the delimiter empty (remove the default value) and set element type to "Repeating record". The default name will be Root_Child1.
Parse it into child nodes with CRLF as delimiter. Set the element type of line 0, the first line 1 and line 2 to "Repeating record" and set it to "Ignore" for the second and third line 1. You will end up with three child records (Root_Child1_Child1, Root_Child1_Child2 and Root_Child1_Child5).
Continue parsing these child records into fields using the semicolon as delimiter and setting tag identifiers to 0, 1 and 2 respectively. Finally, on the record node representing line 2 (Root_Child1_Child5) modify Min Occurs to 0.
Now manually add a sibling record node before Root_Child1 to represent the constant block. Right click it and select "Define Record from Flat File Instance". Select the top five lines, leave the delimiter empty and set the element type to Record. Continue by parsing the record into 5 child records with CRLF as delimiter. You can then parse those child records into field nodes with a semicolon delimiter if you wish.
来源:https://stackoverflow.com/questions/41460041/biztalk2013r2-flat-file-schema-wizard-for-nested-repeating-records