Skip to Content
avatar image
Former Member

Create deep structure from flat input structure

Hi everyone,

I have a tricky mapping task here, which can probably easily be solved with node functions, but I don't have a clue yet how to get it right...

So here's an overview of the structures:


The <line> element contains a key in the beginning, which determines the type of segment to be created, the rest of the fields within the segment are filled with substrings from the rest of the current line.

As you can see, I managed to map the elements on the uppermost level successfully. I did this using the following function (example for ENT):

The fields within that segment are filled simply via substring:

But the problem starts on the next level. If I try to map the ..._CSG element the same way as the ..._ENT element, there's no node created, like in the data example above. How can I achieve to create sub-elements on the 2nd (3rd, 4th, ...) level with flat source data like this?

Thanks a lot in advance!

01.png (10.1 kB)
05.png (43.4 kB)
02.png (2.9 kB)
03.png (2.8 kB)
04.png (2.8 kB)
06.png (7.4 kB)
07.png (2.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

9 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 28, 2017 at 10:23 AM

    Hi Hans,

    The mapping looks fine for FELD001.

    When coming to the parent node there is no need to map the value for it, we can use create if node function instead of If function to generate the parent node.

    Previously i was giving suggestions for FELD001 field, so the value can be displayed. :)

    Regards,

    Avinash

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2017 at 02:42 PM

    Hi Hans,

    Please keep the removecontext node after the if then condition this will remove the suppress values.

    Regards,

    Avinash

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2017 at 12:57 PM

    Hi Hans,

    Could you tell how the parent node is being mapped. If possible cloud you please share the screenshot of the display queue of every node used in mapping the field.

    Regards,

    Avinash

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2017 at 01:43 PM

    Hi Avinash,

    sure, the first nodes (ZSD_KANBAN_PSA, IDOC) are not mapped. they are created automatically.

    Here are some screenshots of the queues:

    ... and here's the one, that's not working:

    Kind regards,

    Hans

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2017 at 02:10 PM

    Hi Hans,

    As per the given screenshots you are not passing the values to the fields, you are just verifying the condition is it true or false so it is taking the null values as result , here target field is not generating as it is taking null as value .

    here you can use if condition to pass the value to the target field, as the target filed has the its minimum occurrence as zero there is no need to use if with else condition.

    Thanks,

    Avinash

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2017 at 02:30 PM

    Hi Avinash,

    thanks for your reply.
    I tried to put in a value other than null into the ..._CSG element by using an if function:

    But that doesn't change anything. CSG is not created.
    By the way, the elements on the upper level (ENT, MID, CDT, BDT) are actually created using a null value, as can be seen in my previous answer. It just doesn't work on the lower levels.

    Kind regards,

    Hans

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2017 at 03:10 PM

    Hi Hans,

    Use constant function node to map the header node and map the value to sub element as its occurrence is 0 to 1 it will generate only one value.

    Regards,

    Avinash

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2017 at 02:59 PM

    Hi Avinash,

    removecontext actually removes the suppress values

    But in the test, the CSG still isn't created:

    I think, the context istn't right for that element. But since we have such a flat source structure, I cant't change to another context in the mapping.

    Kind regards,

    Hans

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 28, 2017 at 09:23 AM

    OK, I finally found a solution for this.
    Instead of the createIf node function, I use a simple ifWithoutElse function, followed by a removeContext to create the elements:

    Then, to fill the values inside the element, I extend the function above a bit and insert a SplitByValue:

    That gives me the desired effect.

    Thank you for your ideas, Avinash.

    Add comment
    10|10000 characters needed characters exceeded