LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Value of Nth item of a Field

    Employee
    Posted 08-26-2015 06:42

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Bryt Park

    Hi,

    I imported a csv file via CSV node, How to I filter to get the Nth item of a given field in that report?


  • 2.  RE: Value of Nth item of a Field

    Employee
    Posted 08-26-2015 06:52

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ryeh

    You could do something like:

    emit *
    where execCount == 10

    That'll get you the tenth record. To be efficient, you should also use the 'consume' function to stop processing any records beyond 10.

    [Addendum: Stony pointed that you could be referring to the 10th field, in which case, you could do something like:

    emit '1:10' as MyField

    Or you could mean something else entirely!]


  • 3.  RE: Value of Nth item of a Field

    Employee
    Posted 08-26-2015 08:59

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Bryt Park

    HI ryeh

    Thanks for the response, it worked perfectly (I meant the 10th record).

    Just one quick question, I searched upon Consume function but still couldn't quite figure out how to use it in my case, could you please advise, thanks.


  • 4.  RE: Value of Nth item of a Field

    Employee
    Posted 08-27-2015 06:38

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: lnason

    Here's an example of consume....I ran this on a data set with 200k records and when I use consume the filter finishes in less than a second. If consume is not used, the node takes 10 seconds to complete.

    include = (execCount == 10)

    emit *
    where include
    consume(1,include)


  • 5.  RE: Value of Nth item of a Field

    Employee
    Posted 08-27-2015 10:27

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Bryt Park

    Awesome! Thanks!