Skip to main content
Solved

How to show information of the selected case in a text field only when just cases with the same context are selected?

  • June 27, 2022
  • 3 replies
  • 9 views

philipp.dehn
Level 10
Forum|alt.badge.img

Hello everyone,

 

we have an analysis sheet that we export as a pdf via action flow. In this sheet we normally filter on a specific plant number before exporting. We want to add the plant description in the analysis as a text field, but only if just cases of one plant are selected. When there are multiple plants selected, the text field should show "Multiple plants selected".

 

I have tried to create a formula and add the result in the text field:

 

CASE

WHEN COUNT(DISTINCT "AUFK"."WERKS") > 1 THEN 'Multiple plants selected''

ELSE "AUFK"."WERKS_TEXT"

END

 

This throws an error as I am mixing aggregate and case based info. I have also tried to add a PU_FIRST to the ELSE statement, but this does not help.

 

Is there a way, how this can be done? Thank you for your help.

Best answer by philipp.dehn

Thank you for the hints. I have solved it using MODE().

 

CASE

WHEN COUNT(DISTINCT „AUFK“.“WERKS“) > 1 THEN ‚Multiple plants selected‘

ELSE MODE(„AUFK“.“WERKS“)

END

3 replies

Hi Philipp ,

Did you try using PU_COUNT ?

 

Regards

Ayan


  • Level 8
  • June 29, 2022

Bind the table with domain_table(..) together with the original table in a PU-Function (maybe PU-COUNT).. and than you can use the normal cases u've mentioned


philipp.dehn
Level 10
Forum|alt.badge.img
  • Author
  • Level 10
  • Answer
  • July 9, 2022

Thank you for the hints. I have solved it using MODE().

 

CASE

WHEN COUNT(DISTINCT „AUFK“.“WERKS“) > 1 THEN ‚Multiple plants selected‘

ELSE MODE(„AUFK“.“WERKS“)

END