influxdata/flux

fetch data according to record number (or row number)

aisiklar opened this issue · 2 comments

Hello
I could not find the correct answer yet and also an example from the docs did not work for me...
So had to write here. Sorry for any possible inconvenience...

In my application,
I want to extract a range of data from (for ex) row2790 to row2800, after it is sorted (for ex, according to _time, desc:true) directly from the query.

I specifically want that range. I don't want to get all the data from row1 to (for ex) row2800..

I found the function findRecord() on the docs.
Not sure whether this will help my problem but nevertheless I tried the sample on this link.
https://docs.influxdata.com/flux/v0/stdlib/universe/findrecord/#extract-a-row-as-a-record

however, it did not give me any result but this error:
"error in query specification while starting program: this Flux script returns no streaming data. Consider adding a "yield" or invoking streaming functions directly, without performing an assignment"

Did not help any if I added yield() at the end of script.

note: for any other query, I can extract data from "sampledata" but the exact script specified on the docs did not work on my case... Maybe findRecord() is not the right solution I am seeking but wanted to mention it here, if I am doing something wrong or there is some other issue here.

Questions:
How can i get the specified range of data according to row number?
What am i doing wrong when trying the findRecord() function?

I will appreciate your answer on this.

Thanks.
alptekin

limit() is your solution. Usage: limit(offset: 2790, n: 10).

@ganko-pi
Hi,
I had used "limit()" function before but just with "n" parameter. Did not know of this use.
This solved my problem. Thanks a lot.