Skip to content

FILTER

The FILTER function returns a new set containing the domains of an existing set that have a score higher than a fraction of that of other domains in the same set.

In the examples below domain labels are also shown, in brackets, to facilitate understanding.

For example, if the hidden results table is the one in the introduction, this snippet:

var workingSet = SET(["1.07", "1.18", "1.01"]);
var mySet = FILTER(workingSet, [16]);

will define and populate mySet this way:

1.01    martial art
1.07    golf

The reason is that the function considers the highest score attributed to domains of the set, that is 60, attributed to domain 1.01, and returns all domains of the set whose score is greater than 16% of that score. This obviously includes domain 1.01, which has the highest score, but also domain 1.07, since 16% of 60 is 9.6 and domain 1.07 has a score of 10, which is above this threshold.
Domain 1.18 is not returned, because it has no score, so it cannot be considered.

In this other example:

var workingSet = SET(["1.07", "1.18", "1.01", "1"]);
var mySet = FILTER(workingSet, [50, 16]);

the function returns:

1   Sport
1.01    martial art
1.07    golf

because it considers the first number as a fraction of the score of the highest ranking domain and the second as a fraction of the lowest score relative to the domains selected by the first fraction.
Thus, if the first fraction determines the return of 1 and 1.01 (since both domains have a score exceeding the 50% of the highest score, which is 90), the second, calculated with respect to the lowest score of the domains determined by the first, will cause the return of 1.07 because its score (10) is greater than 16% of the score of 1.07 (60).

Since the only domains with a score are those listed in the hidden results table, only domains with a matching entry in that table can be returned.

The syntax is:

FILTER(set, [fractions])

where:

  • set is a set variable.
  • fractions is a comma-separated list of integer or decimal numbers representing percentages. Fractions must be interpreted as explained above.