Which task are you trying to solve?
Here is a simple code snippet for filtering out first and last records:
import "sampledata"
data = sampledata.int()
first = data
|> first()
|> tableFind(fn: (key) => key.tag == "t1")
|> getRecord(idx: 0)
last = data
|> last()
|> tableFind(fn: (key) => key.tag == "t1")
|> getRecord(idx: 0)
data
|> filter(fn: (r) => r._value != first._value and r._value != last._value)