cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping to skip first record

Former Member
0 Kudos

Hi there experts!

I have an interface that reads a file that is formed by a number of items like <item> fields... </item>

The first item in the file is one that is 'self explanatory' and has the names of the fields, not the actual info. I need to skip that item (always placed first in the file) and cannot skip it via Content Conversion since it's a receiver channel.

If I put an if like if <item> field value not equals real_value do not match to target the mapping raises an error. How could I achieve this functionality? any hint?

Thanks in advance!

cheers,

Edu

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor

Hi Eduardo,

Check this map:

Whit Index ha get the position in the list and with the NOT i skip the first element mapping.

Regards.

Former Member
0 Kudos

Hi Iñaki,

I've developed the mapping and it works, but I have another problem now. Before this change, the target node would not generate unless some field have the EUR constant in it. Now, the mapping skips the first record, but generates target sources whether it has the EUR constant OR not. See attached the mapping:

cheers,

Edu

azharshaikh
Active Contributor
0 Kudos

Hi Edu,

Can you pls clarify the requirement.

1. Do you want to always suppress the 1st line of the payload?

2. You need to pass only the EUR to target?

pls give full screenshot of ur mapping with Source & Target Structure

Regards,
Azhar

former_member184681
Active Contributor
0 Kudos

Hi Eduardo,

Try replacing the "=" function by equalsS (for String -> comparison to "EUR" constant) and equalsA (for Arithmetic values). The comparison functions sometimes give surprising results

Moreover, if this is something you move from items level to header level, you might have to add one more RemoveContexts function right before the target field.

Regards,

Grzegorz

Former Member
0 Kudos

Hi Azhar,

1. Yes, I have to skip the first <row> of the payload always.

2. That's it, I just have to generate only those <row> that the User_defined_Identifier3 is EUR, not the rest.

find attached the source, target and mapping:

Former Member
0 Kudos

Hi Grzegorz,

that "=" is already an equalsS function! thanx for that!

I'll give the RemoveContexts a try!

Thanks a lot!

cheers,

Edu

former_member184681
Active Contributor
0 Kudos

Edu,

Instead of two If-Then functions, you can also try using just one, along with the And function to join the two conditions. Now that I looked at it again, I think removing contexts would rather make it work even worse then before

Regards,

Grzegorz

Former Member
0 Kudos

Hi Eduardo,

I assume your first row contains the value "EUR"? In this case it is really a matter of context changes. The mapping probably takes the first value in the queue and applies it to all. Try right-clicking on the if-conditions and display the queues like Inaki did. That should give you a hint.

Regards,

Jörg

Former Member
0 Kudos

Hi Grzegorz,

exactly, removing contexts at the bottom right is worse! 😉 I'll try the one if thing!

cheers,

Edu

Former Member
0 Kudos

Hi Jörg,

that's exactly what's happening, the mapping skips the first record an not generates the target node, but then it generates all the rest of <row> as targets, not just the EUR condition...

Since the mapping's been already working, I've just added the new if Iñaki told me in order to not generating the first row, I assumed it would'nt change the rest of rows behavior, Am I wrong?

cheers,

Edu

azharshaikh
Active Contributor
0 Kudos

Hi Edu,

From your inputs it seems that we need to pass ONLY EUR always to the target....and Skip the rest

Can you try with the mapping as shown below

Regards,

Azhar

Former Member
0 Kudos

Hi Azhar,

as I see the only change is to add an IfThenElse instead of an IfThen right before the target... how do yo get the Suppress constant? Just typing 'Suppress'?? I don't see that well at your mapping...

cheers,

Edu

Former Member
0 Kudos

Hello Eduardo,

as Grzegorz already said, probably removing the "Remove Context" step would probably already solve it. Better don't mess with contexts unless you really have to.

Regards,

Jörg

Former Member
0 Kudos

Hi Jörg,

I need to remove contexts because the comparation with the 'EUR' is done INSIDE the <row> element, at one <row> field, but affects to generate the target that might be generated by <row> context.

cheers,

Edu

azharshaikh
Active Contributor
0 Kudos

Hi Edu,

Yes I am just checking for EUR values...if its not EUR it will get Skipped, else pass it to target..first line will also get Skipped as it is not EUR...

You need to mention the Constant value as:

_sUpPresSeD_

to Suppress it.

Hope it helps.

Regards,

Azhar

Former Member
0 Kudos

Hi Azhar!!

thank you very much, that worked!

cheers,

Edu

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Eduardo,

if FCC is not an option, have you considered using the counter functionality in the mapping? If you know you always need to skip the first item, you could implement a check for the first element.

Regards,

Jörg