I want to call the separate two sql in ireport but it shows error like in ireport expression editor of report query with double quote or without double quote but it does not work? Why? I am using postgresql as database. How to fix it?
My code below:
$P{personelId}.equals(null)?"select veriler.*, toplamgun.miktar
from
(select *
from crosstab('select id, ad, soyad, calisma_tipi, sgk_no, ihale_tarihi, giris_tarihi, cikis_tarihi, pirim_gun_sayisi, gun, izin_durum from f_grp_prod('''|| $P{ay} ||''', ''' || $P{yil} || ''' ) order by 1,2',
$$values ('1'::text), ('2'), ('3'), ('4'), ('5'),('6'), ('7'), ('8'), ('9'), ('10'),('11'),
('12'), ('13'), ('14'), ('15'),('16'), ('17'), ('18'), ('19'), ('20'),('21'), ('22'), ('23'), ('24'),
('25'),('26'), ('27'), ('28'), ('29'), ('30'),('31')$$)
as t("id" bigint, "ad" text, "soyad" text, "calisma_tipi" text, "sgk_no" text, "ihale_tarihi" text, "giris_tarihi" text, "cikis_tarihi" text, "pirim_gun_sayisi" text, "1" text, "2" text, "3" text, "4" text, "5" text, "6" text, "7" text, "8" text, "9" text, "10" text,
"11" text, "12" text, "13" text, "14" text, "15" text, "16" text, "17" text, "18" text,
"19" text, "20" text, "21" text, "22" text, "23" text, "24" text, "25" text, "26" text, "27" text,
"28" text, "29" text, "30" text, "31" text))veriler
inner join
(select count(izin_durum) as miktar, id from f_grp_prod('01','2019') where izin_durum = 'X' group by id) toplamgun
on veriler.id = toplamgun.id":
"select veriler.*, toplamgun.miktar
from
(select *
from crosstab('select id, ad, soyad, calisma_tipi, sgk_no, ihale_tarihi, giris_tarihi, cikis_tarihi, pirim_gun_sayisi, gun, izin_durum from f_grp_prod('''|| $P{ay} ||''', ''' || $P{yil} || ''' $P{yil} || ''' ) order by 1,2',
$$values ('1'::text), ('2'), ('3'), ('4'), ('5'),('6'), ('7'), ('8'), ('9'), ('10'),('11'),
('12'), ('13'), ('14'), ('15'),('16'), ('17'), ('18'), ('19'), ('20'),('21'), ('22'), ('23'), ('24'),
('25'),('26'), ('27'), ('28'), ('29'), ('30'),('31')$$)
as t("id" bigint, "ad" text, "soyad" text, "calisma_tipi" text, "sgk_no" text, "ihale_tarihi" text, "giris_tarihi" text, "cikis_tarihi" text, "pirim_gun_sayisi" text, "1" text, "2" text, "3" text, "4" text, "5" text, "6" text, "7" text, "8" text, "9" text, "10" text,
"11" text, "12" text, "13" text, "14" text, "15" text, "16" text, "17" text, "18" text,
"19" text, "20" text, "21" text, "22" text, "23" text, "24" text, "25" text, "26" text, "27" text,
"28" text, "29" text, "30" text, "31" text))veriler
inner join
(select count(izin_durum) as miktar, id from f_grp_prod('01','2019') where izin_durum = 'X' group by id) toplamgun
on veriler.id = toplamgun.id"
Please try to change :
$P{personelId}.equals(null)? "":""
to
$P{personelId} == null ? "":"" OR $P{personelId}.equals("null") ? "":""
OR
try to adapt in your code (Example in MySql):
select if($P{personelId} is null,'flagA','flagB') flag_personelId
from if($P{personelId} is null,'testA','testB') table_test
where findA = if($P{personelId} is null,'0','1')
It's work for me.