martes, 12 de julio de 2022
Get Reference List Name
-- select * from adempiere.fnt_getref_listname(117, 'A');
create or replace function fnt_getref_listname(p_reference_id numeric(10,0), p_value varchar)
returns varchar
as $$
begin
return
(
select
rl.name
from adempiere.fnt_getref_list(p_reference_id) rl
where rl.value = p_value
);
end;
$$ language plpgsql;
-- select * from adempiere.fnt_getref_list(117);
create or replace function fnt_getref_list(p_reference_id numeric(10,0))
returns table
(
value varchar,
name varchar
)
as $$
begin
return query
(
select
rl.value as value_x,
rl.name as name_x
from ad_reference r
join ad_ref_list rl
on r.ad_reference_id = rl.ad_reference_id
where r.validationtype = 'L'
and r.ad_reference_id = p_reference_id
);
end;
$$ language plpgsql;
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario