Render the customer lifetime value ranking
well_render_customer_ltvDraw the customer lifetime value (LTV) ranking as a bar chart card: one bar per customer, the highest first.
Call it once, after well_measure_customer_ltv, and send no figure. It runs the measure itself for the workspace of the call and draws that result, so every name, flag and LTV on the card is the server's. You pass only: window and counterparty_alias_sets exactly as you passed them to the measure, the currency the card draws, left_off_currencies and conversions. Read the figures for your answer from the measure's result, not from this tool's. Do not call it when the measure returned no row: say there is nothing to rank instead.
One currency per card. Set currency to the currency the card draws. Every other currency in the measure's currencies goes in exactly one of two places. Convert it: add a conversions entry with the rate into currency and its date, from the currency conversion step, and the tool applies it to each customer's LTV. Or leave it off: name it in left_off_currencies, which keeps its customers off the card, because Well has no rate for it or because converting it is not allowed. The card's own currency is never converted and never left off. A card that converts draws only when no currency on it, the card's own currency included, has more than 100 customers, because the measure cuts rows past that. Otherwise draw the card's own currency alone and name the others in left_off_currencies.
The card draws at most 12 customers, never a summed "other" bar, and its small form quotes the average LTV per customer. The result states average_ltv, customer_count (the customers the average covers) and left_out_count (customers not drawn): say how many customers the card leaves out when it is above zero.
REFUSED rather than drawn:
a window that reaches the running month or covers more than 60 months
a measured currency that is neither converted nor left off, or a currency the measure did not find
the card's own currency in
left_off_currenciesor inconversionsa rate more than 1% away from Well's stored rate for the pair on its rate date, a rate dated outside the window's last complete month, or two rates for one currency
a card that converts when the measure cut rows from a currency on it
Because the measure runs again here, a ranking reads the invoices twice. That is by design: it is what ties the card to the server's figures.
When party_scope.side_unknown is true the workspace has no resolved own company, so no side filter was applied and the ranking covers invoices on both sides. Say the side is unknown, never that these are the customers' figures.
When the token authorizes one workspace, call this directly — no workspace call is needed first. When it authorizes several, this read will not guess which one you mean: pass workspace_id on the call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| window | Yes | The window the measure read, unchanged: `from` inclusive, `to` exclusive, both YYYY-MM-01. | |
| currency | Yes | The one currency the card draws. | |
| conversions | Yes | One rate for each measured currency the card converts into its own. | |
| workspace_id | No | Target workspace. Omit when the token authorizes one workspace. Required when it authorizes several: this read reports one workspace's own figures and will not choose which. | |
| conversation_id | No | The conversation id returned by the previous Well result, in its meta under well/conversation_id, in its structuredContent, or in its JSON text block. Pass it back on every call in the same conversation, including a call a card makes, so the chosen workspace and the earlier answers still apply. It decides the conversation on its own: nothing the host states about the session replaces it. Omit it only on the first call of a conversation. | |
| workspace_scope | No | Restrict this call to the family: the token's primary workspace plus the company workspaces under it that you are a member of. Unrelated authorized workspaces drop out of the read; row reads merge across the family, while a per-workspace figure still reports exactly one workspace. | |
| left_off_currencies | Yes | The measured currencies the card does not draw. Their customers are not on the card. | |
| counterparty_alias_sets | No | The alias sets passed to the measure, unchanged. Omit when the measure had none. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule | Yes | ||
| window | Yes | ||
| entries | Yes | ||
| partial | Yes | ||
| success | Yes | ||
| currency | Yes | ||
| portfolio | Yes | ||
| average_ltv | Yes | ||
| computed_by | Yes | ||
| conversions | Yes | ||
| party_scope | Yes | What the receivable side resolved to. `side_unknown: true` means the workspace resolved no own company, so NO side filter was applied (`applied: false`) and the ranking covers invoices on both sides — say the side is unknown, never that these are the customers' figures. `null` when no read reported a scope resolution. | |
| young_count | Yes | ||
| customer_count | Yes | ||
| left_out_count | Yes | ||
| conversation_id | No | The conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation. | |
| newly_connected | No | Tools that connected to this workspace since the last result and that no session was told about yet, oldest first. Present only when at least one tool is new. The connected-line rule says when to tell an entry; when it does, one line per entry, in the person's language: "<name> is connected.". Never fold several entries into one sentence. Each entry comes back once, on one result only: never repeat its line later. | |
| omitted_row_count | Yes | ||
| resolved_workspace | No | The workspace that answered, when the caller named none and the token authorizes several. | |
| left_off_currencies | Yes | ||
| conversation_id_note | No | Present only when the server opened a fresh lane, stating that no choice recorded earlier was read. | |
| conversation_id_source | No | Where the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened. | |
| omitted_drawn_row_count | Yes |