Back to questions
JuniorTheoryCommon
What does the program print (lines separated by spaces)?
Продажи = Новый ТаблицаЗначений;
Продажи.Колонки.Добавить("Товар");
Продажи.Колонки.Добавить("Сумма");
Для Каждого Товар Из СтрРазделить("клей,ручка,клей", ",") Цикл
НоваяСтрока = Продажи.Добавить();
НоваяСтрока.Товар = Товар;
НоваяСтрока.Сумма = 100;
КонецЦикла;
Продажи.Свернуть("Товар", "Сумма");
Сообщить(Продажи.Количество());
Сообщить(Продажи.Итог("Сумма"));
Сообщить(Продажи[0].Сумма);2 300 200
- Expecting a merged row to keep the first row's sum: the columns in the second parameter of
Свернутьare added up - Expecting
Свернутьto merge the whole table into one row: rows are grouped by the columns in the first parameter
- What happens to the columns named in neither parameter of
Свернуть? - Why call
Скопировать()before collapsing a table someone passed in?