Запрос = Новый Запрос; Запрос.Текст = "ВЫБРАТЬ | Подразделения.Ссылка, | Подразделения.Наименование |ИЗ | Справочник.Подразделения КАК Подразделения |ГДЕ | Подразделения.Ссылка = &Ссылка"; Запрос.УстановитьПараметр("Ссылка", Подразделение); Выборка = Запрос.Выполнить().Выбрать(); Выборка.Следующий(); Наименование = Выборка.Наименование; Сообщение = Новый СообщениеПользователю; Сообщение.Текст = Наименование; Сообщение.Сообщить();
After the keyword FROM you specify the table to which you want to refer. For example, the Directory. Contractors, and the directory must exist in your configuration. When you set the selection in the request, you need to specify a link (link type), not a name (text type). If you need to find all the elements with similar names, use the design LIKE
UPD:
It is not clear why you want to get the units and most importantly from where?
A small example of receiving data. We have a counterparty directory, it has a subordinate directory of Contractors of Contractors. We need to get all the contracts for the contract Petrov, then the request will be as follows:
// ВЫБРАТЬ ДоговорыКонтрагентов.Ссылка ИЗ Справочник.ДоговорыКонтрагентов КАК ДоговорыКонтрагентов ГДЕ ДоговорыКонтрагентов.Владелец = &Владелец Запрос.УстановитьПараметр("Владелец", КонтрагентПетров); //
