Help with handling different row types in the same flat file
Hi, I have a XML source and need to generate a flat file with fixed width columns handling different row types each with different number of columns. The length of each row is the same i.e. 750 characters. eg. Hcol1col2... Dcol1col2.. Dcol1col2... Fcol1col2... I found this link http://sqlis.com/sqlis/post/Handling-different-row-types-in-the-same-file.aspx with the article "Handling different row types in the same file" which explains the approach but when you have flat file as a source. Could you please help me with the steps i need to follow when i have a flat file destination? would i need to use logic in the script component to generate each row type, then merge the rows and write into the file or is there any other component that would help in merging? Thanks, Smeetha
February 19th, 2011 1:57am

could you tell use sample input data and sample desired results?http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
February 19th, 2011 2:53pm

could you tell use sample input data and sample desired results?http://www.rad.pasfu.com
February 19th, 2011 2:53pm

Hi Reza, As i mentioned in my previous thread last week: With the xml data source having multiple child nodes say <Data> <Student> <GeneralInfo> <Name/> <SSN/>... </GeneralInfo> <ContactInfo> <Email/> <PhoneNo/>.... </ContactInfo> <Courses> <Course> <Subject>Science</Subject> <Testscore>90</TestScore> </Course> <Course> <Subject>English</Subject> <Testscore>80</TestScore> </Course> ... </Courses> </Student> <Student> <GeneralInfo> <Name/> <SSN/>... </GeneralInfo> <ContactInfo> <Email/> <PhoneNo/>.... </ContactInfo> <Courses> <Course> <Subject>Science</Subject> <Testscore>90</TestScore> </Course> <Course> <Subject>English</Subject> <Testscore>80</TestScore> </Course> ... </Courses> </Student>.... </Data> as u can notice.. we have <Data> as the root node and for each <Student> node, the <GeneralInfo> and <ContactInfo> node will occur only once whereas the <Course> child node within <Courses> will be repeating multiple times in the xml. now using this xml source, a flat file needs to be generated with 3 rowtypes for each student in the XML i.e. G for general info, C for contact info and S for tracking courses: GNameSSN... CEmailPhoneNo... SSubjectTestscore... SSubjectTestscore... SSubjectTestscore... GNameSSN... CEmailPhoneNo... SSubjectTestscore... SSubjectTestscore... SSubjectTestscore... .... length of each row is constant i.e. 300. however each row will have its own set of columns with fixed width... Please let me know how would i go about looping for each <Student> node in the XML and generate the flat file. Thanks, Smeetha
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2011 12:18am

Hi Reza, As i mentioned in my previous thread last week: With the xml data source having multiple child nodes say <Data> <Student> <GeneralInfo> <Name/> <SSN/>... </GeneralInfo> <ContactInfo> <Email/> <PhoneNo/>.... </ContactInfo> <Courses> <Course> <Subject>Science</Subject> <Testscore>90</TestScore> </Course> <Course> <Subject>English</Subject> <Testscore>80</TestScore> </Course> ... </Courses> </Student> <Student> <GeneralInfo> <Name/> <SSN/>... </GeneralInfo> <ContactInfo> <Email/> <PhoneNo/>.... </ContactInfo> <Courses> <Course> <Subject>Science</Subject> <Testscore>90</TestScore> </Course> <Course> <Subject>English</Subject> <Testscore>80</TestScore> </Course> ... </Courses> </Student>.... </Data> as u can notice.. we have <Data> as the root node and for each <Student> node, the <GeneralInfo> and <ContactInfo> node will occur only once whereas the <Course> child node within <Courses> will be repeating multiple times in the xml. now using this xml source, a flat file needs to be generated with 3 rowtypes for each student in the XML i.e. G for general info, C for contact info and S for tracking courses: GNameSSN... CEmailPhoneNo... SSubjectTestscore... SSubjectTestscore... SSubjectTestscore... GNameSSN... CEmailPhoneNo... SSubjectTestscore... SSubjectTestscore... SSubjectTestscore... .... length of each row is constant i.e. 300. however each row will have its own set of columns with fixed width... Please let me know how would i go about looping for each <Student> node in the XML and generate the flat file. Thanks, Smeetha
February 20th, 2011 12:18am

You'll get a lot out of reading John Welch's articles on Flat Files. He doesn't have a post specifically on your topic (I thought he did - at least I can't find it). Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
February 21st, 2011 1:33pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics