Описаны наиболее востребованные блоки SQL-запросов, для получения данных из атрибутов
Статус
ДОРАБОТКА
Раздел
Кастомный атрибут основных объектов
Значения
SQL - запрос
Текст
tn_field_string
select tfs."value" as v
from tn_field_string tfs
join tn_field tf on tf.id = tfs.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'
Число
tn_field_decimal
select tfd."value" as v
from tn_field_decimal tfd
join tn_field tf on tf.id = tfd.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'
Дата
tn_field_dateonly
select tfs."value" as v
from tn_field_dateonly tfd
join tn_field tf on tf.id = tfd.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'
Время
tn_field_timeonly
select tfs."value" as v
from tn_field_timeonly tft
join tn_field tf on tf.id = tft.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'
Дата и время
tn_field_datetime
select tfs."value" as v
from tn_field_datetime tfdt
join tn_field tf on tf.id = tfdt.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'
Субъект СО
tn_field_string
coalesce((select string_agg(SPLIT_PART(tfs.value, '%', 1),',') as v
from tn_field_string tfs
join tn_field tf on tf.id = tfs.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type
and tf.cmjfield = '{storage-field name}'),'Не указано')
Атрибут комплексного справочника
Все атрибуты комлескного справочника текстовые.
Значения
SQL - запрос
Текст
classifier_complex
(select title from classifier_complex where classifier_complex.id = (
select complex1.id
from clscom_tag tag1
left join clscom_to_tag to_tag1 on to_tag1.tag = tag1.id
left join classifier_complex complex1 on complex1.id = to_tag1.classifier
left join cls_typeComp typecom1 on typecom1.id = complex1.owner
where tag1.schema = 'ComplectClassifierWP'
and typecom1.alias = '{storage-field name}' and tag1.id = tag.id)) as Office