Статус

Раздел


Получение значений из кастомных полей

ЗначенияSQL - запрос

Текст

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.cmjfield = 'stage'

Число

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.cmjfield = 'index'

Дата

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.cmjfield = 'eventD'

Время

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.cmjfield = 'eventT'

Дата и время

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.cmjfield = 'eventDT'

Субъект СО

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.cmjfield = 'Employee'),'Не указано')