Skip to main content

Hi all, 

 

We are in IFS Cloud 22R2 SU17

It seems that it is not possible to use input parameters in the quick reports with SQL expressions when you need to indicate them in the Group By section. 

 

For example: 

SELECT 
CASE WHEN ip.PART_NO LIKE concat(&Type1, '%') THEN 'Electrique'
WHEN ip.PART_NO LIKE concat(&Type2, '%') THEN 'Roulement'
ELSE 'Autres' 
END type_article,
count(ip.PART_NO)
FROM INVENTORY_PART ip 
WHERE SECOND_COMMODITY = '300'
GROUP BY CASE WHEN ip.PART_NO LIKE concat(&Type1, '%') THEN 'Electrique'
WHEN ip.PART_NO LIKE concat(&Type2, '%') THEN 'Roulement'
ELSE 'Autres'
END

 

The request is allowed by the system but when you execute it, you have an error message “NOT A GROUP BY EXPRESSION”

 

Are you aware about this problem ? Is it a bug ? 

 

Thanks in advance 

 

Regards 

 

Hello @ARNDUP,

The issue you faced is not related to the ifs itself; it is due to an incorrect query expression. Please use ‘ip.part’ after the ‘group by’ statement and and include a ‘having’ statement before the ‘case when’ expression in the last line. As follows;

SELECT 
CASE WHEN ip.PART_NO LIKE concat(&Type1, '%') THEN 'Electrique'
WHEN ip.PART_NO LIKE concat(&Type2, '%') THEN 'Roulement'
ELSE 'Autres' 
END type_article,
count(ip.PART_NO)
FROM INVENTORY_PART ip 
WHERE SECOND_COMMODITY = '300'
GROUP BY ip.PART_NO having CASE WHEN ip.PART_NO LIKE concat(&Type1, '%') THEN 'Electrique'
WHEN ip.PART_NO LIKE concat(&Type2, '%') THEN 'Roulement'
ELSE 'Autres'
END

Regards,

Umran


Hello;

If you try this way you won't get any errors

 

 


select
ab.type_article,
count(ab.part_no) as part_count
from
(
SELECT 
CASE WHEN ip.PART_NO LIKE concat(&Type1, '%') THEN 'Electrique'
WHEN ip.PART_NO LIKE concat(&Type2, '%') THEN 'Roulement'
ELSE 'Autres' 
END type_article,
ip.PART_NO
FROM INVENTORY_PART ip 
WHERE ip.SECOND_COMMODITY = '300'
) ab
group by
ab.type_article


Hi @uaksoy , @asahin 

 

Thanks for your answers. 

 

it is helpful 

 

@asahin ‘s request works. @uaksoy ‘s one gives me an error in the detail of the quick report 

 

 


Reply