Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
i want to set the Range of the tsamplerow so that every 10th row will be processed
eg. 10,20,30,40,...
in this case i don't now the end of the line or i can set a big end of the range.
such as 10,20,30,40,...,40000 will be possible
how must i set it?
Thanks Andreas
Hi,
The most simple way is to add a numeric sequence to your inbound record. Then add an output expression where the reminder of sequence number division by 10 should be zero. In this way, you can pick the records which are 10,20,30, etc.
If you can use a context variable instead of 10, then you can change this from 10 to evry 5 records or every 7 records and so on.
To put an upper cutoff limit, you need to add another output filter condition where the sequence number generated should be less than the upper cutoff number (again a context variable which can be set at beginning of job).
Hope it has helped you
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
You might find this easier using a tMap and a modulus operator. For example, look at the tMap I have quickly knocked up below....
You will have to excuse the column names. In this example newColumn is your ID column. What I have done is used a filter in the outbound table. What the filter does is only pass the data out for records where the field holding the ID (newColumn) is divisible by 10. The code I have used is below....
row8.newColumn % 10 ==0
This says where the value is divisible by 10 with a remainder equalling 0.
Give that a try. You do not need to know the total number of rows for this.
Or
Use below condition in filterrow ( Use Advance Mode)
Mathematical.MOD(Numeric.sequence("s1",1,1),10) == 0.0
Do not forget to reset the sequence at the end of subjob.
all soulutions work for me.
Thank you very mutch
Thanks for the confirmation. Could you please close the topic by marking the posts which helped you to get solution?
This will help the Talend community when other members are searching for the solutions. Always people will tend to select the topics which are marked as closed with solutions.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂