|
Rank: Newbie
Joined: 1/29/2018 Posts: 6 Location: USA
|
I'm working with a flat file that has orders separated by a header line. I have the order separation working, but within each order I have an H2 line with address information. In all cases, I'll have one with a type of ST like this:
H2 ST ADD1 ADD2 ADD3 CITY STATE ZIP COUNTRY
In some cases, I'll have an address type of CS in addition to this:
H2 ST ADD1 ADD2 ADD3 CITY STATE ZIP COUNTRY H2 CS ADD1 ADD2 ADD3 CITY STATE ZIP COUNTRY
What i need to do is say: "If you have an H2 with a type of CS, then use the address information from that line. Else, use the address information from the ST line".
|
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 558
|
I would do that as demonstrated by the attached example. File Attachment(s): example.zip (3kb) downloaded 128 time(s).
|
|
Rank: Newbie
Joined: 1/29/2018 Posts: 6 Location: USA
|
Brilliant...I struggled with that for hours and hours. Thank you!
I'm stuck on one last piece that I was hoping to figure out on my own, but I think there may be some conflict going on. Aside from the information that I mentioned earlier, I also have some other some other data which I've sampled below. Each time we see an H1, this signifies a new order. Each H1 will have at least one H2 and one D1. We could have two or three H2 values and multiple D1 values. The H2 values are address variants and the D1 values are products. Occassiaionlly, we'll also have a D3 entry. If we see the D3 value, then we want to pass along some data from within this field. For some reason, I'm not able to pull data out of this D3 and into where I want to.
I'm specifically looking at the order on lines 95-99. This is the 19th order in the file. I can map this to one area of the end xml file, but not to others. I've attached my files and mapping. Is there some reason that I can map the title field to one place in the file, but not another?
H1 H2 D1
H1 H2 D1
H1 H2 H2 D1 D3
On a side note, I used your earlier logic a little differently since I had all the fields already there, so I just added in the exists logic and drew my connections, it's working great!File Attachment(s): test_v7.zip (25kb) downloaded 130 time(s).
mbaile attached the following image(s):
|
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 558
|
The problem is that you're driving an ancestor of BOOK_TITLE, ORDER_ITEM, by a peer of the FLF-D3 which contains DESC. FLF-D1 is connected to ORDER_ITEM, and FLF-D3/DESC is connected to ORDER_ITEM/BOOK/BOOK_NUMBER.
For that record, there are four occurrences of the Switch node. Occurence 3 contains the FLF-D1, and occurrence 4 contains the FLF-D3. You'll need to do some filtering to look up the correct FLF-D3 to use, I guess.
You can use the "1/27" and "1/4" buttons in FlexText itself to navigate around the various occurences of your repeated splits and switches to see exactly how the text is parsed.
|
|
Rank: Newbie
Joined: 1/29/2018 Posts: 6 Location: USA
|
That makes sense, thanks for the clarification. In the 27 sample orders provided to us, there are many that have multiple D1's (order lines) in some of the orders, but in the case where a D3 has been provided, we only have one D1 line. This is good as the ISBN in the D1 corresponds to the title from the D3. Even though there are only one of each, I still can't pull the title so I'll have to get the filter logic together to pull that data. This will be even more important if we ever get a file with multiple D1's and multiple D3's as we'll have to link them together somehow (I'll also confirm with our customer if this will ever happen).
Looking at the file, I'm not sure what to filter on and don't see anything that corresponds between the D1 and D3 elements...I thought something like that would be simple..shows what I know!
Thanks again for all of your help, much appreciated.
|
|
guest |