I make a request:

ЗапросПодразделения = Новый Запрос; ЗапросПодразделения.Текст = "ВЫБРАТЬ | Подразделения.Ссылка, | Подразделения.Наименование |ИЗ | Справочник.Подразделения КАК Подразделения |ГДЕ | Подразделения.Наименование = &Наименование"; ЗапросПодразделения.УстановитьПараметр("Наименование", Пользователь); ВыборкаП = ЗапросПодразделения.Выполнить().Выбрать(); ВыборкаП.Следующий(); Сообщить(ВыборкаП.Ссылка); 

The error goes:

  Таблица не найдена "Справочник.Подразделения" 

How else can you get a unit? By partner, for example, or by the name of the unit, such as "Moscow"?

  • maybe you want to get all the units your partner worked with? - Yegor Sokolov

1 answer 1

 Запрос = Новый Запрос; Запрос.Текст = "ВЫБРАТЬ | Подразделения.Ссылка, | Подразделения.Наименование |ИЗ | Справочник.Подразделения КАК Подразделения |ГДЕ | Подразделения.Ссылка = &Ссылка"; Запрос.УстановитьПараметр("Ссылка", Подразделение); Выборка = Запрос.Выполнить().Выбрать(); Выборка.Следующий(); Наименование = Выборка.Наименование; Сообщение = Новый СообщениеПользователю; Сообщение.Текст = Наименование; Сообщение.Сообщить(); 

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:

 // ВЫБРАТЬ ДоговорыКонтрагентов.Ссылка ИЗ Справочник.ДоговорыКонтрагентов КАК ДоговорыКонтрагентов ГДЕ ДоговорыКонтрагентов.Владелец = &Владелец Запрос.УстановитьПараметр("Владелец", КонтрагентПетров); // 

alt text

  • Well, how to choose, I understand, thank you. The question was how to get units. What configuration - I do not even know, only the version is known - 8.2. - lampa
  • 8.2 - this is the platform version - Egor Sokolov
  • @ Egor Sokolov on UPD: I already understood how requests and other buns are made. I just do not understand why the table "Directory. Subdivisions" does not exist and which table instead. The search is silent as a partisan. - lampa
  • Open the metadata tree, see what reference books you have. Or if you have a prop that you envision as a unit, then look at its typeYegor Sokolov.
  • @ Yegor Sokolov hmm, I don’t have this directory. It's a shame. Well, okay, bye said to score on it. Thank you, in the future they will come back, of course. - lampa