cancel
Showing results for 
Search instead for 
Did you mean: 

Context - SortBy - Help

Former Member
0 Kudos

Hi,

I'm facing to a problem with the good management of Context.

For once, each try I done with "UseOneAsMany" was unsuccessfull... Maybe I need to a SortbyKey...

If you have time to help me.

Source


item_10
... field_10_A
... field_10_B
... field_10_C
item_20
... field_20_A
... field_20_B
... field_20_C
item_30
... field_30_A
... field_30_B
... field_30_C
etc...

Wanted target: for each Item, I generate LineA, LineB, LineC


//------- info of item 10 ----
Line_A
.... field_10_A
Line_B
.... field_10_B
Line_C
.... field_10_C
//------- info of item 20 ----
Line_A
.... field_20_A
Line_B
.... field_20_B
Line_C
.... field_20_C
//------- info of item 30 ----
Line_A
.... field_30_A
Line_B
.... field_30_B
Line_C
.... field_30_C

Note: there is no special level for an item, we just have:


LineA     // of item 10
LineB
LineC
LineA      // of item 20
LineB
LineC...

And my current Target is something like that...


//------- info of item 10 ----
Line_A
.... field_10_A
Line_A
.... field_20_A
Line_A
.... field_30_A

Line_B
.... field_10_B
Line_B
.... field_20_B
Line_B
.... field_30_B

Line_C
.... field_10_C
Line_C
.... field_10_C
Line_C
.... field_10_C

So:


LineA     // of item 10
LineA     // of item 20
LineA     // of item 30
LineB     // of item 10
LineB     // of item 20
LineB     // of item 30
etc...    group by LineX and not one after the other.

Thanks

Mickael

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

It is not possible to have alternating nodes in XML after mapping and though the content conversion of the file adapter is able to handle this, I am not even sure if there is any way to describe such a structure with xds.

As workaround I have once created a structure with middle nodes which can be transformed with the MessageTransformbean (as the transformation here works different as in the file adapter channel):

helpernode
   Line_A
    .... field_10_A
    Line_B
    .... field_10_B
    Line_C
    .... field_10_C
helpernode
    Line_A
    .... field_20_A
    Line_B
    .... field_20_B
    Line_C
    .... field_20_C
helpernode
    Line_A
    .... field_30_A
    Line_B
    .... field_30_B
   Line_C
   .... field_30_C

Former Member
0 Kudos

Hi Stephan,

the pb is that target is not a file but it's the Idoc TXTRAW.TXTRAW02, so I cannot add a "helpernode", but thanks for your suggestion

Mickael

Edited by: Mickael Huchet on Apr 30, 2008 1:40 PM

stefan_grube
Active Contributor
0 Kudos

What about a two step mapping? The first with the helper node, the second without.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

Why not, but if we can do it without, that will help me... because this interface is already in Production, but now the client want ASAP more details in this idoc...

I continue my search...

but why not...

Mickael

stefan_grube
Active Contributor
0 Kudos

Is Line_A Line_B Line_C always the same node? And field_xx the same?

Then a UDF with 3 input parameters can help to keep the sequence.

Regards

Stefan

Former Member
0 Kudos

Yes !

- Line_A, Line_B, Line_C go to segment E1TXTRW (raw)

- field_nn_X go to field TLINE of segment E1TXTRW.

Mickael

stefan_grube
Active Contributor
0 Kudos

And what about the source nodes? Are the named also equal? And the elements different? Like:

node

- A

- B

- C

Then you can have something like this:

...

result.addValue(A);

result.addValue(B);

result.addValue(C);

...

then use node - udf - TLINE

node - udf - splitbyValue - TLINE

This is only a sketch, I have not tested this.

Regards

Stefan

Former Member
0 Kudos

Hi Stephan,

thanks you for your help, that help me to solve this issue.

The right solution is:

1. create a UDF with:

result.addValue(A[0]);

result.addValue(B[0]);

result.addValue(C[0]);

2. Then use it like that:


node - udf - removeContext - E1TXTRW   (raw , Line_X)
node - udf - splitbyValue - TLINE      (field_nn_xx)

Regards.

Mickael

Answers (1)

Answers (1)

former_member556603
Active Contributor
0 Kudos

Hello Mickael,

Just go through this imp blog..

/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13

Thanks,

Satya kumar