Hi all,
Does anyone know a technique for extracting a range of values from a sorted list of variable length?
I can already get the TOP() 10 values, but I need to get the next range. Eg I need to get values 11 to 20.
My apologies for asking this twice. -I suspect I tagged and worded my first question poorly.
Thanks in advance
Stel
Solved! Go to Solution.
Hi @Stelio_Pappas ,
You could try the below expression
TOP ( [SortedList]- (TOP ( [SortedList] , [From]-1) ), [To] - [From]+1)
[SortedList] is list of sorted text elements. [From] and [To] are number type columns defining the range. I tested the expression on text elements list, even though it should typically work on lists of other elements as well.
Hi @Stelio_Pappas ,
You could try the below expression
TOP ( [SortedList]- (TOP ( [SortedList] , [From]-1) ), [To] - [From]+1)
[SortedList] is list of sorted text elements. [From] and [To] are number type columns defining the range. I tested the expression on text elements list, even though it should typically work on lists of other elements as well.
That is excellent.
I was very close. I remember thinking if only there was a way to chop off the first 10 values. -It never occurred to me to subtract one list from another.
Thank you @Suvrutt_Gurjar!
You are welcome @Stelio_Pappas. Good to know it meeds the need.
Yes, clubbing of two TOP() functions or if I may say, to โtop upโ one TOP() function with another TOP() seems to fit the requirement well.
User | Count |
---|---|
16 | |
9 | |
9 | |
7 | |
3 |