Atomic operations for modifying an existing data composition schema: adding, deleting, and modifying fields, totals, filters, parameters, variant settings, structure management, query replacement.
Parameters and command
| Parameter | Description |
|---|---|
TemplatePath |
Path to Template.xml (or to the folder — auto-completion Ext/Template.xml) |
Operation |
Operation (see the list below) |
Value |
Operation value (shorthand string or query text) |
DataSet |
(optional) Data set name (default: first) |
Variant |
(optional) Settings variant name (default: first) |
NoSelection |
(optional) Do not add the field to the variant's selection |
powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/skd-edit.ps1" -TemplatePath "<path>" -Operation <op> -Value "<value>"
Batch mode (batch)
Multiple values in one call separated by ;;:
-Operation add-field -Value "Цена: decimal(15,2) ;; Количество: decimal(15,3) ;; Сумма: decimal(15,2)"
Works for all operations except set-query, set-structure и add-dataSet.
Operations
add-field — add a field to the data set
Shorthand: "Имя [Заголовок]: тип @роль #ограничение".
"Цена: decimal(15,2)"
"Организация [Орг-ция]: CatalogRef.Организации @dimension"
"Служебное: string #noFilter #noOrder"
The field is added to the set and to the variant's selection (if there is no -NoSelection). Duplicate dataPath — warning, skipped.
To make the field go into the selection of a specific structure grouping rather than the variant — use -NoSelection and then add-selection "Имя @group=ИмяГруппы".
add-total — add a total
Shorthand: "<dataPath>: <выражение>". If the expression is a known aggregate function without parentheses (Сумма, Количество, Минимум, Максимум, Среднее), it is automatically wrapped in Func(dataPath). If the function has parentheses or is an arbitrary expression — it is used as is.
"Цена: Среднее" # → Среднее(Цена)
"Стоимость: Сумма(Кол * Цена)" # → как есть
"Проверка: Проверка" # identity: выражение = Проверка
add-calculated-field — add a calculated field
Shorthand: "Имя [Заголовок]: тип = Выражение #noFilter #noOrder #noGroup".
"Маржа = Продажа - Закупка"
"Наценка [Наценка, %]: decimal(10,2) = Маржа / Закупка * 100"
"Служебное: string = \"\" #noFilter #noOrder #noGroup"
#noFilter, #noOrder, #noGroup, #noField → <useRestriction> (similar to add-field).
It is also added to the variant's selection.
add-parameter — add a parameter
"Период [Отчетный период]: StandardPeriod = LastMonth @autoDates"
"Организация: CatalogRef.Организации"
Shorthand: "Имя [Заголовок]: тип = значение [availableValue=список] [@флаги]". [Заголовок] optional — adds <title>.
Flags:
@autoDates— generates a pair of hidden parametersДатаНачала/ДатаОкончанияfor a StandardPeriod parameter.@hidden— hides the parameter from user settings (for constant parameters used in the query).@always— the parameter is always substituted into the query. Often together with@hidden, but it is also used separately (for visible required parameters such as the reporting period).@valueList— allows passing a list of values into the parameter (with a list value it is implied automatically below, no need to specify it separately).
List value: several values are set by default via a comma in значение. For a comma inside a single value — quotes '...'.
"Виды [Виды субконто]: ChartOfCharacteristicTypesRef.ВидыСубконтоХозрасчетные = ПланВидовХарактеристик.ВидыСубконтоХозрасчетные.Контрагенты, ПланВидовХарактеристик.ВидыСубконтоХозрасчетные.Договоры"
"ПС: CatalogRef.Контрагенты = Справочник.Контрагенты.ПустаяСсылка @hidden"
"Период: StandardPeriod = LastMonth @always"
"ПСчет: ChartOfAccountsRef.Хозрасчетный = ПланСчетов.Хозрасчетный.X @hidden @always"
"Округление: EnumRef.Округления = Окр1 availableValue=Перечисление.Округления.Окр1: руб., Перечисление.Округления.Окр1000: тыс."
availableValue= sets the initial list of allowed values. List format: v1[: p1], v2[: p2], ... — elements separated by ,, representation after :. If the value or representation contains , or : — wrap it in single quotes '...':
"Округление: ... = Окр1 availableValue=Окр1_00: 'руб., коп.', Окр1: руб."
modify-parameter — modify an existing parameter
Shorthand: "ИмяПараметра [Заголовок] [ключ=значение]... [@флаги]". Finds the parameter by name, updates the specified properties.
"ПорядокОкругления use=Always"
"ПорядокОкругления [Округление сумм] denyIncompleteValues=true"
"ПериодОтчета [Отчетный период]" # только title
"ПорядокОкругления availableValue=Перечисление.Округления.Окр1: руб., Перечисление.Округления.Окр1000: тыс."
"СчетПС value=ПланСчетов.Хозрасчетный.КассаПредприятия"
"Виды value=ПланВидовХарактеристик.ВидыСубконтоХозрасчетные.Контрагенты, ПланВидовХарактеристик.ВидыСубконтоХозрасчетные.Договоры"
"Контрагент @hidden @always"
[Заголовок] optional — sets or replaces <title>. Can be called without other kv pairs to only update the title.
availableValue= replaces the entire list of allowed values (the old ones are deleted). Format and quotes — the same as in add-parameter.
value= replaces the parameter value. Several values separated by commas → list of values (replaces all previous ones); for a comma inside a value — quotes '...'.
Flags @hidden / @always — the same as in add-parameter. Idempotent.
rename-parameter — rename a parameter
Shorthand: "OldName => NewName". Atomically updates the parameter name, references &Имя in expressions of other parameters (only full matches, &ПериодX is not affected), and entries in dataParameters of all variants. Does not touch the query text — renaming is strictly within the parameter scope.
"Период => ПериодОтчета"
reorder-parameters — reorder parameters in the specified order
Shorthand: "Имя1, Имя2, Имя3". A partial list — the specified parameters come first in the given order, the rest keep their original order and go at the end. Parameters from the list that are not in the schema — warning, skipped.
"ПериодОтчета, НачалоПериода, КонецПериода"
add-filter — add a filter to a variant
Shorthand: "Поле оператор значение @флаги". Flags: @off (use=false), @user (userSettingID=auto), @quickAccess, @normal, @inaccessible.
"Номенклатура = _ @off @user"
"Дата >= 2024-01-01T00:00:00"
"Статус filled"
add-dataParameter — add a data parameter to the variant
Shorthand: "Имя [= значение] @флаги".
"Период = LastMonth @user"
"Организация @off @user"
add-order — add sorting
Shorthand: "Поле [desc]". Default is asc. Auto — auto element.
"Количество desc"
"Auto"
add-selection — add a selection item
"Номенклатура"
"Auto"
"Folder(Поступление: ПолеА, ПолеБ, ПолеВ)"
Folder(Название: поле1, поле2) — a group of fields (SelectedItemFolder) with a title and placement=Auto.
@group=ИмяГруппировки — add to the selection of a named grouping (instead of the variant level):
"Folder(Поступление: ПолеА, ПолеБ) @group=ДанныеОтчета"
add-dataSetLink — add a data set link
Shorthand: "Источник > Приёмник on ВырИсточника = ВырПриёмника [param Имя]".
"Набор1 > Набор2 on Поле1 = Поле2"
"Набор1 > Набор2 on Поле1 = Поле2 [param Связь]"
add-dataSet — add a data set
Shorthand: "Имя: ТЕКСТ_ЗАПРОСА" or "ТЕКСТ_ЗАПРОСА" (auto name НаборДанныхN).
"Доп: ВЫБРАТЬ 1 КАК Тест"
"ВЫБРАТЬ Ссылка ИЗ Справочник.Номенклатура"
"Продажи: @queries/sales.sql"
dataSource is taken from the first existing one. Duplicate name — warning, skipped. Does not support batch mode (the request may contain ;;).
add-variant — add a settings variant
Shorthand: "Имя [Представление]". The presentation is optional, defaults to the name.
"Детальный"
"Детальный [Детальный отчёт]"
Creates a variant with Auto selection + detail group. Duplicate name — warning, skipped.
add-conditionalAppearance — add conditional appearance
Shorthand: "Параметр = значение [when условие] [for Поле1, Поле2]". Block when — syntax add-filter (Field operator value).
"ЦветТекста = web:Red when Сумма < 0"
"ЦветФона = web:LightGreen when Статус = Одобрен for Статус"
"МинимальнаяШирина = 50 for Организация"
"Формат = ЧДЦ=2 for Цена, Сумма"
Appearance value types (auto-detect): web:*/style:*/win:* → Color, true/false → Boolean, parameter Формат/Текст/Заголовок → LocalStringType, otherwise String.
Filter value types (auto-detect): Перечисление.*/Справочник.*/ПланСчетов.*/Документ.* → DesignTimeValue, true/false → Boolean, date → DateTime, numbers → Decimal, otherwise String.
OrGroup: several conditions via or в when are combined into FilterItemGroup/OrGroup:
"Формат = ЧЦ=15; ЧДЦ=0 when ПараметрыДанных.Округление = Перечисление.Округления.Окр1 or ПараметрыДанных.Округление = Перечисление.Округления.Окр1000"
Important: for data parameters use the prefix ПараметрыДанных. in the filter field.
add-drilldown — connect drilldown to resources in templates
Value — resource names (as in the fields/calculated fields of the DCS) separated by commas.
"ПоступлениеИзПроизводства, ВыбытиеПрочее"
"Сумма_Дт83, Сумма_Дт99, Сумма_68, Сумма_84"
Connects DrillDown by ИмяРесурса to all templates containing the specified resources. Idempotent.
set-query — replace the query text
Does not support batch mode. Value — the full query text or @path/to/file.sql (a reference to an external file). The path is resolved relative to Template.xml, then CWD.
When what: substantial rework (add fields, joins, rewrite the batch) → upload the query via /skd-info <tpl> -Mode query -Name <набор> -Raw -OutFile file.sql, edit the file, return set-query @file. -Raw sends the request entirely without decorations, so the upload ↔ return are exact (including multi-packet requests). Point replacement (rename an identifier, replace a substring) → no upload is needed, use patch-query below.
patch-query — point replacement in the query text
Shorthand: "старое => новое [@once]". By default replaces all occurrences of the substring. Supports batch mode and -DataSet.
"СубконтоДт1) В => СубконтоКт1) В"
"КАК ВТ_СтароеИмя => КАК ВТ_НовоеИмя @once"
@once — fail with an error if the query does not have exactly one occurrence. Protects against accidental replacements in comments and identical identifiers.
Multiline substrings are supported.
set-outputParameter — set the output parameter
"Заголовок = Мой отчёт"
"ВыводитьЗаголовок = true"
If the parameter already exists — replaces the value.
set-structure — set the variant structure
Shorthand: "Поле1 > Поле2 > details". > — nested grouping level, , — multiple fields in one level, details — detail records. Replaces the entire structure completely (including Selection/order/filter/conditionalAppearance of each group). For point modification of grouping fields while preserving settings — use modify-structure. Does not support batch mode.
"Организация > Номенклатура > details"
"Валюта, НаименованиеБанка, ИНН"
"details"
"СчетМеждународногоУчета @name=ДанныеОтчета"
@name=Имя — assigns a name to the grouping (<dcsset:name>). Used to bind templates via groupName.
modify-structure — modify the grouping fields of an existing group
Same shorthand as set-structure. Finds the group by @name=, replaces only <groupItems> (grouping fields). Selection/order/filter/conditionalAppearance/outputParameters of the group are preserved. Without @name= — error.
"Валюта @name=ДанныеОтчета"
"Валюта, НаименованиеБанка @name=ДанныеОтчета"
"details @name=ДанныеОтчета"
modify-field — modify an existing field
Same shorthand as add-field. Finds by dataPath, merges properties (non-empty ones override), preserves position.
"Цена [Цена USD]: decimal(10,4) @dimension"
set-field-role — set the field role
Shorthand: "<dataPath> [@флаги] [kv=значение]". Completely replaces the field role. If the value contains only dataPath without flags/kv — deletes the role.
"Сумма" # снять роль полностью
"СуммаОстаток @balance" # простая балансовая роль
"СуммаНач @balance balanceGroupName=Сумма balanceType=OpeningBalance" # с уточнением
"Контрагент @dimension parentDimension=Группа"
"Период @period" # роль периода
Flags: @balance, @dimension, @account, @period, @required, @autoOrder, @ignoreNullValues.
KV: balanceGroupName, balanceType (OpeningBalance/ClosingBalance), parentDimension, accountTypeExpression, orderType (Asc/Desc), expression, periodNumber, periodType.
Supports batch mode (;;).
modify-filter — modify an existing filter
Same shorthand as add-filter. Finds by field, updates operator/value/flags. See the rule for <use> below.
modify-dataParameter — modify data parameter
The same shorthand as add-dataParameter. Finds by name, updates value/flags. See the rule for <use> below.
Rule <use> for modify-filter / modify-dataParameter
Unlike add-*, в modify-* the field <use> is updated only if the flag is set explicitly:
@off— set<use>false</use>@on— remove the existing<use>false</use>(enable the parameter)- neither
@off, nor@onis set —<use>is not touched, the existing value is preserved (important: this means that a disabled parameter will remain disabled after other properties are modified)
remove-* и clear-*
| Operation | Value | Action |
|---|---|---|
remove-field |
dataPath | Removes the field from the set + from the variant's selection |
remove-total |
dataPath | Removes the total |
remove-calculated-field |
dataPath | Removes the calculated field + from selection |
remove-parameter |
name | Removes the parameter |
remove-filter |
field | Removes the first filter with the specified field |
clear-selection |
* |
Clears all selection elements |
clear-order |
* |
Clears all order elements |
clear-filter |
* |
Clears all filter elements |
clear-conditionalAppearance |
* |
Clears all conditional formatting rules |
Verification
/skd-validate <TemplatePath> — валидация структуры после редактирования
/skd-info <TemplatePath> — визуальная сводка