cancel
Showing results for 
Search instead for 
Did you mean: 

Drop first record

mongley
New Contributor II

Hi All,

I have a variable number of records coming from a mapper and will always want to drop the first. Is there an easy way to do this?

Thanks,
Mark

1 ACCEPTED SOLUTION

tstack
Former Employee

If you need to drop records, the Filter snap is usually a good option. In this case, you can use the snap.in.totalCount variable to get the total number of records that have been read by the snap. So, to skip the first one, you can use the following for the Filter Expression in the snap configuration:

snap.in.totalCount != 1

View solution in original post

6 REPLIES 6

christwr
Contributor III

There are some Head/Tail snaps you might be able to use. Perhaps a Tail snap with an offset of 1.

mongley
New Contributor II

Thanks, I have taken a look at Head and Tail. They look like they would do the job however I need to know the number of documents to be processed - which I don’t. Is there a method that would return this?

christwr
Contributor III

There is an Aggregate snap, which you do stuff like COUNT, but not sure it’s worth it. If you did a Head snap with Offset=1 and Documents=1000000 (or some arbitrary max) would that work?

mongley
New Contributor II

Hi Chris, yes that works thanks