Four Stars

How to filter out elements in a tHMap SimpleLoop

I'm fairly new to Talend. I have a Job that convert JSON to XML using a tHMap. In the mapper, under each JSON record I have an sub array of "providers" as input that output to
"xml_providers". I'm using a SimpleLoop to iterate over "providers" specified by a sort. All works ok so far.

 

The challenge is to not emit (or filter out) some of the "providers" based on certain criteria in a Java function:

    public static boolean includeProvider(currentProviderInLoop, providers) {

        <some criteria returning a Boolean>

    }

 

I have looked at Filter -> isValid and ValidateGroup but nothing is working.

 

I couldn't find any working example or online (with images) on how to accomplish that.

 

  • Data Integration
1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: How to filter out elements in a tHMap SimpleLoop

In this video you will find examples:

https://www.youtube.com/watch?v=rC7O2-u9pGc

3 REPLIES
Six Stars

Re: How to filter out elements in a tHMap SimpleLoop

Hi,

You could use the filter of your simple loop.

Eric

Four Stars

Re: How to filter out elements in a tHMap SimpleLoop

That's what I've been trying to use. But isn't any good example anywhere, something with step by step screenshots.

Six Stars

Re: How to filter out elements in a tHMap SimpleLoop

In this video you will find examples:

https://www.youtube.com/watch?v=rC7O2-u9pGc