One Star

Creating or skipping multiple rows

I find I'm using tJavaFlex quite a bit for doing some procedural things.
In one example i want to effectively filter out/discard output rows but can't see how to do this. ie I normally do some processing and set the values in the output struct schema accordingly but sometimes I want to prevent the row being passed on (filter out) any further for some reason - is this possible? (the workaround I have is to set a flag in the schema and subsequently use a tFilterRow but it would be nice to be able to avoid this).
On a similar note there are also times when one wants to output, based ona single input row, two or more output rows (like the tNormalize component [this seems to have disappeared from the latest version[) - is that possible as well?
Thanks,
T
8 REPLIES
Community Manager

Re: Creating or skipping multiple rows

Hello
but sometimes I want to prevent the row being passed on (filter out) any further for some reason - is this possible?

Did you try the tUniqRow component?
like the tNormalize component this seems to have disappeared from the latest version[)

tNormalize is still present in the latest version.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Creating or skipping multiple rows

Thanks Shong,
I was thinking more along the lines of being able to set something like:
row1 = null
in the component and then have the wrapper around it recognise that this meant the current row did not need adding to the output stream - at the moment it is fixed (AFAICT) at a 1:1 relationship between input and output - ie 1000 rows in become 1000 rows out and the only workaround to remove unwanted data is to flag the row and then use a filter component to drop it.
The flipside was wanting to generate additional rows in the output stream and I gave tNormalize as an example of the sort of thing - how would you achieve that functionality in tJavaFlex?
T
Community Manager

Re: Creating or skipping multiple rows

Hello
As your said, you can't filter rows on tJavaFlex, it always output the same number of rows as input flow, you have to do it on filter component such as tFilterRow, tMap.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Creating or skipping multiple rows

OK _ where are the component sources? I would like to propose the above enhancement - namely that if you have row1 as the input class that setting row1 = null in your code would result in that row being skipped when handling the output stream...
Mark
Community Manager

Re: Creating or skipping multiple rows

Hello
The source file of component locates on plugins\org.talend.designer.components.localprovider_4.0.2.r43696\components\tJavaFlex, you can reference other component like tFilterRow and modify the component.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Creating or skipping multiple rows

I see now to enable filtering and/or multiplying requires config of the xml COMPONENT nodes - does this have to be done statically (ie a "permanent" mod to the installed component) or is there any way of toggling this at runtime? It seems like it could be quite useful to enable this for stuff like tJavaFlex but presumably the reason not to enable by default is for performance and code clarity?
How does the properties file (eg tNomalize_java.xml get processed at runtime? Is it compiled into the .class file of the component itself or stored somewhere else?
T
Community Manager

Re: Creating or skipping multiple rows

Hello
(ie a "permanent" mod to the installed component) or is there any way of toggling this at runtime? It seems like it could be quite useful to enable this for stuff like tJavaFlex but presumably the reason not to enable by default is for performance and code clarity?

It have be done statically, you have to install the component in each installation of TOS/TIS, however, I suggest you to create a new component by copying the source file of tJavaFlex and modify them, to avoid influencing the default behavior of tJavaFlex.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Creating or skipping multiple rows

Thanks, yes I found it. As far as filtering /out/ rows is concerned it would be a valid enhancement to the existing component to handle the specific case where the output row was set to null and to just ignore passing it down the chain. I'm still not quite sure how you would allow the creation of new rows in the data but it's not of pressing urgency right now...
T