Default forecast pivot to value column with pf_iter rows

New forecasts opened the pivot with all dimensions stacked as
group_by and the date column as split_by — wide and slow to read.
Open with just the value column showing and pf_iter as rows so the
first thing you see is iteration totals.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Paul Trowbridge 2026-04-29 11:08:43 -04:00
parent 408cb06150
commit 4fde752b54

View File

@ -238,11 +238,14 @@ export default function Forecast({ sourceId, versionId }) {
await viewer.restore(cfg)
if (cfg.expand_depth != null) await applyDepth(cfg.expand_depth)
} else {
const dims = meta.filter(c => c.role === 'dimension').map(c => c.cname)
const dateCol = meta.find(c => c.role === 'date')?.cname
const cfg = { table: tableName, settings: false, plugin_config: { edit_mode: 'SELECT_REGION' } }
if (dims.length) cfg.group_by = dims.slice(0, 2)
if (dateCol) cfg.split_by = [dateCol]
const valueCol = meta.find(c => c.role === 'value')?.cname
const cfg = {
table: tableName,
settings: false,
group_by: ['pf_iter'],
columns: valueCol ? [valueCol] : [],
plugin_config: { edit_mode: 'SELECT_REGION' }
}
await viewer.restore(cfg)
}