Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

samplerow how to set the Range

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

Labels (2)
5 Replies
Anonymous
Not applicable
Author

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 0683p000009MACn.png

 

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 🙂

Anonymous
Not applicable
Author

You might find this easier using a tMap and a modulus operator. For example, look at the tMap I have quickly knocked up below....

0683p000009M1is.png

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.

akumar2301
Specialist II
Specialist II

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.

Anonymous
Not applicable
Author

all soulutions work for me.

Thank you very mutch

Anonymous
Not applicable
Author

@af99 

 

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 🙂