Skip to main content
Question

Error in quick report while using an imput parameter in Group by


ARNDUP
Do Gooder (Customer)
Forum|alt.badge.img+2

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 

 

uaksoy
Do Gooder (Customer)
Forum|alt.badge.img+2
  • Do Gooder (Customer)
  • July 16, 2024

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


asahin
Do Gooder (Customer)
Forum|alt.badge.img+4
  • Do Gooder (Customer)
  • July 16, 2024

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


ARNDUP
Do Gooder (Customer)
Forum|alt.badge.img+2
  • Do Gooder (Customer)
  • July 19, 2024

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings