How to filter API result to show only every Xth entry?

Hi there,

I’m grabbing a set of intraday stock prices for some charts I’m building via API. All works fine.

The data is received as 1-minute data. How can I can apply a filter on that data so that I only display every 5th piece of data, or every 10th piece of data? The same concept would apply to repeating groups where I might want to only display every Xth line and ignore all of the others.

Any ideas?

Thanks,
Dan

Look into Modulo

This can be a bit tricky using API results, as the sort-ability and filtering of an API call is dependent on the capabilities of the API server itself.

As @GH5T said, you can use the <-modulo-> operator in a condition on your repeating group’s cell’s interior group’s visibility - and if you have the “collapse when hidden” option checked, this will have the effect of collapsing your entire RG cell if it doesn’t pass the condition.

<-modulo-> returns the remainder when you divide the number before the operator by the number after it. For example, the expression 3 ← modulo → 2 would return “1” because 3 / 2 has a remainder of 1.

The condition to show every “5th” cell would be “only when current cell's index <- modulo -> 5 is 0 or current cell's index is 1 -> this element is visible

1 Like

Thanks Sam,

This gives me something to play with. I’ve used Modulo in the past for simple things like highlighting every other row, etc. Good information.

Thanks,
Dan