cancel
Showing results for 
Search instead for 
Did you mean: 

Create deep structure from flat input structure

Former Member
0 Kudos

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!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (8)

Answers (8)

Former Member

Hi Hans,

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

Regards,

Avinash

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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