hi guys ,
can anyone tell me the steps to insert data from flat file into database.i am able to do it but only the first record is inserted.
the flat file consists of more than 10 records.
thanks in advance
hi guys ,
Need more information…Can you describe how you are inserting the data from flat file into data base.Here are steps to parse a flat file and inserting data.
1.Define a flat file schema depending upon the flat file structure
2.Write a wrapper service in which the first service is pub.file:getFile
3.Invoke pub.flatFile:convertToValues which returns Document
4.Loop through the document list if it contains multiple records and insert each record into database
thanks jyothi ,
yes i did the same way as u described and not able to give the loop i will thankfull to u if u give me a detailed explaination on the 4th step.
thanks a lot
If you set the Max Repeat attribute of the record definition in your flat file schema to “unlimited”, the pub.flatFile:convertToValues service will return a documentList containing an entry for each record in your flat file.
Use the LOOP statement to process each document in the documentList. In a sequence inside the loop, use a JDBC adapter insert or update service to add each document to the database. Commit the transaction after your LOOP statement if you are using XA transaction management functionality.
If terms like documentList, loop and sequence are unfamiliar to you (at least in a webMethods context), I would encourage you to work through the examples in the WmSamples package.