Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Change column names Version 1 (Net)

Группа действий: Таблицы 

Описание

Действие предназначено для изменения названий столбцов таблицы.

Image Removed

Настройки

Action group: Tables

...

Description

The action is intended for changing the names of table columns

Action icon

Image Added

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
TableThe table in which you want to change the column names

Свойство

Описание

Тип

Пример заполнения

Обязательность заполнения поля

Параметры

Таблица

Таблица, в которой необходимо изменить названия столбцов
.Robin.DataTable
Да

Yes

Названия столбцов

Список новых названий, которыми будут заменены текущие названия столбцов
Columns namesList of new names that will replace the current column names.Robin.Collection

Да

Особые условия использования

  • На вход принимает коллекцию, содержащую список новых названий для столбцов входной таблицы.
  • Переименование столбцов происходит по порядку: 1й элемент коллекции - 1й столбец, 2й элемент - 2й столбец, и т.д.
  • Если в коллекции элементов меньше, чем кол-во столбцов таблицы, действие не возвращает ошибку, а переименовывает все столбцы, на которых хватило элементов.
  • Если в коллекции элементов больше, чем кол-во столбцов таблицы, действие не возвращает ошибку, лишние элементы просто не используются.
  • Если в коллекции содержатся одинаковые названия, действие вернет ошибку.

Пример использования 

Пример использования

Задача: существует документ Excel с таблицей, необходимо изменить названия столбцов у таблицы  на "название страны", "название столицы". Таблицу с низменными столбцами необходимо вставить ниже , начиная с ячейки А9.

Image Removed

Решение: воспользоваться действиями "Открыть", "Взять таблицу", "Изменить названия столбцов", "Вставить таблицу",  "Сохранить".

Реализация: 

...


Yes

Special conditions of use

  • It takes as input a collection containing a list of new names for the columns of the input table.
  • The columns are renamed in order: 1st element of the collection - 1st column, 2nd element - 2nd column, etc.
  • If there are fewer items in the collection than the number of columns in the table, the action does not return an error, but renames all columns that have enough items.
  • If the collection contains more items than the number of columns in the table, the action does not return an error, the extra items are simply not used.
  • If the collection contains identical names, the action returns an error.

Example of use

Task 

There is an Excel document with a table, it is necessary to change the column names of the table to "country name", "capital city name". The table with lowered columns should be inserted below, starting from cell A9.

Image Added

Solution

Use the actions "Open", "Get table", "Change column names", "Insert table", "Save".

Implementation

  1. Assemble a robot scheme consisting of the actions: "Open", '"Get table", "Change column names", "Insert table", "Save".
    Image Added
  2. Configure parameters for the "Open" action. In the "Path to file" field, specify the path to the required Excel file. Check the Visible = true checkbox to display robot actions on the screen. 
    Image Added
  3. Set the parameters for the "Get table" action. Specify the context of the opened document in the "Context" field, create a variable of the "Table" type to which the data will be written and specify it in the "Result" field. Check the checkbox "Heading" = true.  Leave the rest of the fields empty, because it is necessary to take the table completely.  
    Image Added
  4. Set up the parameters for the "Change column names" action. In the "Table" field specify a variable of the "Table" type obtained at the previous step. 
    Image Added

    In the "Columns names" field, specify a variable of type "String" with the required column names. 
    Image Added

    5. Set the parameters of the "Insert table" action.

    Image Added


    6. Customize parameters for the "Save" action. Specify the context of the Excel document in the Context parameter.
    Image Added


  5. Start the robot using the "Start" button in the top panel. 

Result

The program robot completed successfully. 

Image Added

The names of the columns in the Excel spreadsheet have been changed

...

Результат: 

Робот отработал успешно. 

Image Removed

В таблице Excel изменены названия столбцов