thisRecordPONum = null;
for (i=0; i<parsedFlatfile.size(); i++) {
if (parsedFlatfile[i].POLineItemNum == 01) {
thisRecordPONum = parsedFlatfile[i].PONumber;
UDM udm = new UDM();
** mapp this record into the canonical.
}
if (parsedFlatfile[i].POLineItemNum != 01 && parsedFlatfile[i].PONumber == thisRecordPONum)
** mapp this record into the canonical.
}
}
Is there a Tutorial or something around which explains how to us the above if statements? I have gone through the Advanced Flows Tutorial and it is not much help. Any help is greatly appreciated.
It looks to me that the crux of your question is how to handle flat file content. This is a much bigger question than BRANCHING. Once you have solved the issue of getting your source content into a webMethods data structure (IData), you will be ready to manipulate and branch based on the content.
My apologies if I have misinterpreted your question.
Yes, I am past handling/parsing the flat file content. Also, I looked at the Ezine article on Writing Custom Content Handlers (this the only one I could find by Igor Androsov. Is this the one you were talking about?
I am using the EDI Adaptor to in parsing the legacy flat file. I have done that sucessfully. So, since I have parsed the flat file, using the convertToValues service, it outputs a record containing the parsed data. I am now trying to take that data and map it into a UDM/Cononical record (this record is actually based on the OAGIS BOD show_po). Since in the legacy file there are Purchase Order rows, I am trying to create a specific record containing the purchase order header and line item data. So, I am trying to put structure around the legacy flat file.
Below is a copy and paste of the flow service I am currently testing this out with.
I think I am doing something wrong with the double loops, or maybe I could be using the BRANCH statement being using incorrectly? In my first posting, this is ideally what I am trying to do with this. Is there a way to use the BRANCH statement in a better way? Is there anything I can do better that jumps out at you? Is there an example that shows how to do this type of a complex loop, and branch anywhere, and how to create temporary fields within the loop, and then to output each PO, while populating each UDM/Canonical. There may be 10 PO’s and each PO has various line items. Once one PO and the line items for that PO have been mapped, I want to then send that PO somewhere and then move onto the next PO in the record.
I know I could write a Java Service which would do this, but ideally I want to do this within Flow. Are there any limitations to doing this within Flow? Do you think this would have to be done in a Java Service? Logically, this would be easy, but very time consuming.
Another thing that might trip you up is the recordToDocument - if you suspect that looping is not working properly - its a common problem that webMethods does not create an array for you (when your source content has only one instance of a particular record) and the result is that the loop is completely bypassed. Have a close look at the docs for documentToRecord.
In order to store processed PO’s - you have a couple of options. There is a facility called the repository. Have a look at STORE services within the docs. Basically this is a facility to store and retrieve records as name value pairs. Be careful with this - I have not used it in production. Some recent discussion threads indicate the repository to be the source of some grief!
The only other way that I can think of is to write a java service to store and retrieve records (like a HashTable). This may be an adequate solution.
Another facility I really like is queryDocument. This allows you to extract data from your source document with fairly simple XQL queries. This may take away some of the need for complex looping and branching.