K
Docs
API Reference→Pieces→Top List
🏆

Top List

vault.topThe VaultVault

Sorts a table by one column and hands back the top rows — a leaderboard in one piece. Each row gets a place number too ({{item.place}} in a Loop), and empty values always sort last. Filter it to make per-team or per-server boards.

When to use this
  • →Loop over the list — {{item.place}} is 1, 2, 3… and every column is there too
  • →Lowest first makes speed-run boards: the smallest time wins
  • →Pair with Find Rank to also tell someone their own spot

On the canvas

This is what Top List looks like when you place it on your flow. Each field below is something you configure in the inspector panel.

🏆
Top List
vault.top
Vault
tablerequired
Pick a table…
columnrequired
e.g. xp
order
select…
limit
10 (up to 100)
filterColumn
Every row
filterOp
select…
filterValue
e.g. {{input.user.id}}
asrequired
top
found
empty

Config fields

FieldTypeReqWhat it does
table
Pick a table…
textyesTable 🗄️
column
e.g. xp
textyesSort by 🏆
orderselect—Which way 🔃
limit
10 (up to 100)
number—How many 🔢
filterColumn
Every row
text—Only rows where… 🔍
filterOpselect—Is…
filterValue
e.g. {{input.user.id}}
text—This value
as
top
textyesSave it as ✨

Output ports

foundAt least one row
emptyThe table (or filter) has no rows yet
📐

In TypeScript, this would be…

Not something you need to write — just a look at what Kitcord does for you.

TypeScript
const top = await db.all(
  "SELECT * FROM levels ORDER BY xp IS NULL, xp DESC LIMIT ?",
  [10],
);
top.forEach((row, i) => (row.place = i + 1)); // {{item.place}} in a Loop