We have a requirement to process a complex flat file.
Flat file will have larger number of records in a parent child relationship depicted below:
0001|abc|def… Parent Record.
0001|abc|def…Parent Record
0002|abc|def…Child Record
0001|abc|def…Parent Record
0002|abc|def…Child Record
0003|abc|def…Child Record
The record starts with 0001 is the parent record and all the below records will be its child record until it encounters another 0001 record.
Our requirement is publish all the parent and child records together like:
0001|abc|def…
one doc will be publish containing only this record.
0001|abc|def…Parent Record
0002|abc|def…Child Record
One doc will be published containing these two records.
0001|abc|def…Parent Record
0002|abc|def…Child Record
0003|abc|def…Child Record
One doc will be published containing these three records.
Basically in total only 3 docs will be published .
Please let us know how we can implement this in wm 6.5
Does the parent and child records have same number of fields? If so, a generic dict/schema will convert this data to an IS document, and using the flow logic, u can determine each group that can be published to broker.
Thx for response. Ya all the aprent child has same number of fields.
Also apart from creating the dic/schema, We have done below steps:
Convert the flat file to string
then convert the string to string list and then loop over the string list then using the flow logic we are segregating the records according to parent child relationships.
You are getting flatfile as your input right? Why do you parse it to IS doc, and then again convert it to string/string list?
The records seems to have record identifier. convertToValues service displays records in IS doc format after parsing. In this doc, you can see a string called ‘record-id’ which will hold the value of identifier. You can loop over IS doc (ffvalues) directly and perform some logic i believe.