IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Nesting LoopNodes of X12 Options · View
Rajkun
Posted: Thursday, March 23, 2017 12:38:40 PM
Rank: Member

Joined: 3/22/2017
Posts: 10
Location: USA
Hi everyone, I'm new to Altova Correct me if I'm wrong.

I'm in a situation to map XML schema File to X12 and here I have a problem to get the actual X12 structure.

Requirements:
X12.6020 - 811 (Consolidated Service Invoice/Statement)
The Contract Level (Detail) HL Loop will occur once for every ContractId.
The Activity Level (Sub-Detail) HL Loop will occur once for every activityNbr.
The Flow Dates/Quantity (Sub-Sub-Detail) HL Loop will occur once for every set of flow dates.

Picture of the Actual X12 Structure and My mapped X12 Structure
https://ibb.co/cWFBAa


Picture of the XML file
https://ibb.co/ggZDqa

Picture of the Mapping from XML to X12
https://ibb.co/k5qWbF

In the above XML all notice Objects are grouped using 'group-adjecent' library function based on 'contractId' and each group should have one 'Detail' and I need to iterate though the individual group and create 'Sub-detail' and 'Sub-sub-detail' for each notice under group.



File Attachment(s):
Invoice_Data.xml (5kb) downloaded 558 time(s).
Schema_For_Invoice.xsd (3kb) downloaded 491 time(s).
XML_TO_X12_Map_Design.mfd (18kb) downloaded 503 time(s).


K101
Posted: Thursday, March 23, 2017 3:47:35 PM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 564
Instead of pictures, please just attach your actual files. Then we have something we can actually work with rather than merely look at.

If your files are sensitive in some way, either contact Altova Support directly, or create a copy of your input data which is not sensitive.
Rajkun
Posted: Thursday, March 23, 2017 5:27:47 PM
Rank: Member

Joined: 3/22/2017
Posts: 10
Location: USA
K101 wrote:
Instead of pictures, please just attach your actual files. Then we have something we can actually work with rather than merely look at.

If your files are sensitive in some way, either contact Altova Support directly, or create a copy of your input data which is not sensitive.


I've attached the files. The attached are sample (Where data is altered in schema file as it is sensitive). And on mfd file I got stuck while mapping LoopHL that can represent the X12 output in correct structure for LoopHL segment/node.
K101
Posted: Friday, March 24, 2017 11:31:20 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 564
1. The mapping you attached uses different schema and instance files. It seems possible to change the mapping to use the ones you attached, so I did that

2. Most likely you need to add the HL hierarchy to the 811.Config itself. MapForce's regular X12 templates don't include the different HL levels for technical reasons. HOWEVER, MapForce's HIPAA X12 configurations use a more advanced format and do. So, you can upgrade the regular X12 6020 811 to use the HIPAA style. Then, you'll have three levels of LoopHL to map to, and that should make it easier for you.

Download these files. Move the 'X12.6020.v4\' folder to 'C:\Program Files\Altova\MapForce2017\MapForceEDI\'. In this upgraded config, I've created three HL levels: "Detail", "Sub-Detail," and "Sub-Sub-Detail". I included only the LoopIT1 sub-substructure within each level. You can easily restore others from the regular X12 6020 811.Config as necessary. (Note also that the previously-optional F734 field has been made mandatory in X12.Segment so it will automatically be completed.)

3. The "Correct" vs. "My" output examples you posted the image of don't appear to contain the same data. It would be helpful to see an example of the desired output using the exact XML input file you attached here. The attached example mapping may or may not be the right starting point for what you want.
Rajkun
Posted: Monday, March 27, 2017 3:12:44 PM
Rank: Member

Joined: 3/22/2017
Posts: 10
Location: USA
K101 wrote:
1. The mapping you attached uses different schema and instance files. It seems possible to change the mapping to use the ones you attached, so I did that

2. Most likely you need to add the HL hierarchy to the 811.Config itself. MapForce's regular X12 templates don't include the different HL levels for technical reasons. HOWEVER, MapForce's HIPAA X12 configurations use a more advanced format and do. So, you can upgrade the regular X12 6020 811 to use the HIPAA style. Then, you'll have three levels of LoopHL to map to, and that should make it easier for you.

Download these files. Move the 'X12.6020.v4\' folder to 'C:\Program Files\Altova\MapForce2017\MapForceEDI\'. In this upgraded config, I've created three HL levels: "Detail", "Sub-Detail," and "Sub-Sub-Detail". I included only the LoopIT1 sub-substructure within each level. You can easily restore others from the regular X12 6020 811.Config as necessary. (Note also that the previously-optional F734 field has been made mandatory in X12.Segment so it will automatically be completed.)

3. The "Correct" vs. "My" output examples you posted the image of don't appear to contain the same data. It would be helpful to see an example of the desired output using the exact XML input file you attached here. The attached example mapping may or may not be the right starting point for what you want.

Hi, Many thanks for the reply. The information on point 2 ie., "Modifying HL hierarchy" worked perfectly by modifying 811.config file, but I'm not sure if I can change the 811 standard hierarchy as it was agreed standard between me and my partner, although it works perfect for my situation.
I read about non inline functions, which I think could be helpful to get the HL loop hierarchy. If I'm correct on using non inline function, can you help me on how to use functions to get desired HL hierarchy or if there is any another alternate solution for the problem.

And I talked with my partner he is okay with HL hierarchy structure (ie., it can be all Details, followed by all sub-Details, and followed by all sub-sub-Details) as long as the HL loop generates proper sequence ie.,HL01 the sequence and HL02 points the proper parent HL.

and the condition for HL grouping are:

1. The Detail Level HL Loop will occur once for every Requester Contract. The requester contract is unique. So, group all the notices with same contract number.

2. The Sub-Detail Level HL Loop will occur once for every group of activity Number. The Detail HL loop can have multiple activity numbers, which can be repeated or can be different activity number. (group the same activity number into sub-detail HL that are under the detail HL group).

3. The Sub-sub-Detail HL Loop will occur once for every set of flow dates. (under each activity level(sub-detail) group check for flow-date and group them into sub-sub-detail HL loop).

Note: The invoice Object has the values for 'requester contract', 'activity number', and 'flow dates'. The same group of notices has same contract number.

lets say if I've invoice list of as shown below.

Code:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<datasetInvoice>
    <controlNumber>1456</controlNumber>
    <serviceGivenBy>AA Company</serviceGivenBy>
    <serviceTakenBy>BB Company</serviceTakenBy>
    <invoiceList>
        <invoice>
            <activityNbr>1</activityNbr>
            <flowDate>2016-12-13T09:00:00-05:00</flowDate>
            <contractId>1</contractId>
        </invoice>
        <invoice>
            <activityNbr>1</activityNbr>
            <flowDate>2016-12-14T09:00:00-05:00</flowDate>
            <contractId>1</contractId>
        </invoice>
        <invoice>
            <activityNbr>2</activityNbr>
            <flowDate>2016-12-13T09:00:00-05:00</flowDate>
            <contractId>1</contractId>
        </invoice>
        <invoice>
            <activityNbr>1</activityNbr>
            <flowDate>2016-12-13T09:00:00-05:00</flowDate>
            <contractId>2</contractId>
        </invoice>
        <invoice>
            <activityNbr>2</activityNbr>
            <flowDate>2016-12-14T09:00:00-05:00</flowDate>
            <contractId>2</contractId>
        </invoice>
        <invoice>
            <activityNbr>2</activityNbr>
            <flowDate>2016-12-14T09:00:00-05:00</flowDate>
            <contractId>2</contractId>
        </invoice>
    </invoiceList>
</datasetInvoice>


Result should be like:

Code:

HL*1**IB
IT1*1
REF*KSR*1 ------------------------> 1st Contract Number
HL*2*1*9
IT1*2
REF*BE*1~  -----------------------> 1st Activity Number
HL*3*2*IA~
IT1*3~
DTM*405****RD8*2016-12-13T09:00:00-05:00~ ------------> 1st FlowDate
HL*4*2*IA~
IT1*4~
DTM*405****RD8*2016-12-14T09:00:00-05:00~ ------------> 2nd FlowDate
HL*5*1*9
IT1*5
REF*BE*2~  -----------------------> 2nd Activity Number
HL*6*5*IA~
IT1*6~
DTM*405****RD8*2016-12-13T09:00:00-05:00~ ------------> 1st FlowDate
HL*7**IB
IT1*7
REF*KSR*2 ------------------------> 2nd Contract Number
HL*8*7*9
IT1*8
REF*BE*1~  -----------------------> 1st Activity Number
HL*9*8*IA~
IT1*9~
DTM*405****RD8*2016-12-13T09:00:00-05:00~ ------------> 1st FlowDate
HL*10*7*9
IT1*10
REF*BE*2~  -----------------------> 2nd Activity Number
HL*11*10*IA~
IT1*11~
DTM*405****RD8*2016-12-14T09:00:00-05:00~ ------------> 1st FlowDate

K101
Posted: Tuesday, March 28, 2017 7:51:34 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 564
If you're referring to non-inline recursive functions, those can be useful for working with hierarchical structures, but I don't see how they're necessary for the output you describe, which can be achieved by using the customized 811.Config I previously supplied you and the attached example mapping.

(I think your sample X12 output was missing the second FlowDate for the second contract's second activity. Also, I changed the "seconds" of all the FlowDates to be unique so it's easier to see at a glance where they ended up.)

File Attachment(s):
Example.2017-03-28.zip (4kb) downloaded 512 time(s).

K101 attached the following image(s):
Example.png

Rajkun
Posted: Tuesday, March 28, 2017 12:58:12 PM
Rank: Member

Joined: 3/22/2017
Posts: 10
Location: USA
Hi, once again thanks for your effort on providing the answer to my question.

The information you posted on your last reply was very helpful, many thanks.

Quote:
(I think your sample X12 output was missing the second FlowDate for the second contract's second activity. Also, I changed the "seconds" of all the FlowDates to be unique so it's easier to see at a glance where they ended up.)


It was my mistake, while writing output I thought group by remove duplicate value. My bad, thanks for the catch (I should have used distinct-values library function for that purpose).


I'm able to achieve the required result by you'r suggestions.

Thanks.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.