Read scalar values from your registered data while building the report —
useful for conditional layout, threshold checks, or derived metrics without
re-querying the original DataFrame. Plus visual.copy() for stamping
configured visuals.
Query any registered dataset by name — no visual required:
| Parameter | Type | Default | Description |
|---|---|---|---|
data_source_name |
str |
(required) | The dataset name passed to add_df(). |
column_name |
str |
(required) | The column to read. |
row_index |
int |
-1 |
Row index; negatives count from the end (-1 = last row). |
Raises ValueError for unknown datasets/columns, IndexError for
out-of-range rows, and ValueError for derived datasets
(they exist only in the browser — compute with pandas instead).
TARGET = 120_000
worst = min(report.get_value("sales", "revenue", i) for i in range(len(sales_df)))
if worst < TARGET:
page.add_row().add_card(
title="Warning: underperforming region detected",
text=f"Lowest revenue is ${worst:,} — below the ${TARGET:,} target.",
content_type="md",
)(Or use on_condition() instead of the if.)
Read the value a specific visual represents, from its backing DataFrame. The
visual must be in the report tree, and its props must include row_index and
value_column (so it fits KPI- and
Gauge-style visuals):
kpi = page.add_row().add_kpi("sales", value_column="revenue", row_index=0,
title="Revenue – North", format="currency")
north_revenue = kpi.get_value()Duplicate a visual — same type, dataset, props, and annotations, new unique
id. Mutate copy.props for what differs, then re-add with
row.add_visual(copy.type, visual=copy):
proto = row.add_kpi("sales", value_column="revenue", row_index=0,
title="Revenue – North", format="currency")
for i, region in enumerate(["South", "East", "West"], start=1):
copy = proto.copy()
copy.props["row_index"] = i
copy.props["title"] = f"Revenue – {region}"
row.add_visual(copy.type, visual=copy)Each copy exposes get_value() once it's in the tree.
get_value() reads the original, unfiltered DataFrame stored at
add_df() time. Client-side filter= /
aggregate= / formulas and
derived datasets run in the browser and don't affect
it — use pandas for filtered/aggregated build-time values.
- Conditional layout — act on the values you read.
- Card templates — compute at view time instead.