A
A
AlexCruel2021-04-15 17:18:39
1C
AlexCruel, 2021-04-15 17:18:39

How to get the reference object by the value of add. props?

There is, for example, the nomenclature. She is full. She has an additional requisite - "Guarantee".
It is necessary to find this nomenclature for this attribute.

Ном = Справочники.Номенклатура.Найти???

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Vodakov, 2021-04-15
@WaterSmith

Ном = Справочники.Номенклатура.НайтиПоРеквизиту("Гарантия", ЗначениеРеквизита);

This method is suitable for searching by reference details. And it only searches for the first element, and fails if there are more than one.
But, since you write that you need to search for additional attributes, then you will have to write a request, and the solution depends on how additional attributes are implemented in your configuration.
For example, in the UNF configuration, additional details are elements of the tabular part of the Nomenclature directory. In this case, the "property", i.e. attribute name, in your case "Warranty", this is a plan of types of characteristics Additional Requisites and Information. The request will look something like this:
Запрос = Новый Запрос;
  Запрос.Текст = 
    "ВЫБРАТЬ РАЗЛИЧНЫЕ
    |	НоменклатураДополнительныеРеквизиты.Ссылка КАК НоменклатураСсылка
    |ИЗ
    |	Справочник.Номенклатура.ДополнительныеРеквизиты КАК НоменклатураДополнительныеРеквизиты
    |ГДЕ
    |	НоменклатураДополнительныеРеквизиты.Свойство = &Свойство
    |	И НоменклатураДополнительныеРеквизиты.Значение = &Значение";
  
  Запрос.УстановитьПараметр("Значение", ЗначениеГарантии);
  Запрос.УстановитьПараметр("Свойство", СсылкаНаПВХ_Гарантия);
  
  РезультатЗапроса = Запрос.Выполнить();
  
  ВыборкаДетальныеЗаписи = РезультатЗапроса.Выбрать();
  
  Пока ВыборкаДетальныеЗаписи.Следующий() Цикл
    // Вставить обработку выборки ВыборкаДетальныеЗаписи
  КонецЦикла;

K
Konstantin, 2021-04-15
@fosihas

look in the object where the additional props are recorded, there is a prop on which object it belongs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question