Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Header / Detail Output

Status
Not open for further replies.

dgerdner

Programmer
Mar 30, 2005
41
0
0
US
Some of my EDI outbound messages require a header/detail format, such as:

ST (A)
LX (1)
LX (2)
ST (B)
LX (1)
LX (2)
LX (3)
ST (C)
LX (1)
...

I use a database table for input that joins my header and detail information. When I create my output I always end up with:

ST (A)
LX (1)
ST (A)
LX (2)
ST (B)
LX (1)
ST (B)
LX (2)
ST (B)
LX (3)
...

Can someone describe how I can achieve my desired results?
 
Hi,

Can you please describe us the way you called the functional map.

paste in the rule you have used.

regards,

Samji.
 
I'll give it a shot. I have one input card that represents the database table. In simplest terms, it is the ungrouped header/detail data which read sequentially would look like this:

A 1
A 2
B 1
B 2
B 3
C 1

My first output card is an EDI message:

#300 Transaction RO Outbound Partner Set V4010 ANSI EDI

The "A","B", and "C" are mapped to ST02. Then, for "LoopLX RO300" I have "ForEachItem(In1)". The ForEachItem functional map places the item number to LX01.

Does that help?

 
Hi,

I am not very sure but I guess we can try out one way.
Create a work file with structure some thing like

A 1,2
B 1,2,3
C 1,2,..


And then use this again to process the data.

I guess there will be simpler ways to achieve your result by using extract or some other functions.

Regards,

Samji.


 
You could also use two intermediate cards to format the data and pass that to a third card. There are proabably 5 or more different ways to do this.

JuJutsu - Jeff S.
Support Analyst
 
Hi,

I found some simpler way to do this.

At the message level
=f_messg(UNIQUE(field1:Record:input),input)

Input 1: Unique values in coloumn 1 from data base.
i.e A,B,C

Input 2: Pass the entire file.

Now inside the f_messg function

Map the unique value to ST and write a functional map for LX

=f_LX(extract(field2:Record:In1,field1:Record:In1=unique field1))

I think this will work out.

Regards,

Samji






 
Samji;

I think you've probably got my solution, if I can just interpret it correctly. I'm a bit stuck on:

=f_LX(extract(field2:Record:In1,field1:Record:In1=unique field1))

My input 1 does not have a field2; it's just the A,B,C identifiers. Also, I don't see any reference to Input Card 2. Can you expand a bit?
 

If I am not wrong..you will be having two input cards
in the f_messg map

=f_messg(UNIQUE(field1:Record:input),input)

1st input you are passing A,B,C all the unique values

2nd Input ,you will be passing the entire data i.e

A 1
A 2
A 3
A 4
B 1
B 2
.
.
.

So when you come inside the f_messg map you will be having these two input cards.

So you will be mapping unique values to ST and write a functional map for LX

I tried this using flat files and using the data you provided and tried to get the output as
A 1,2,3
B 1,2
C 1,2,3..

I guess the logic used here will also work for the edi message.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top