Skip to main content
May 16, 2023 10:22 AM UTC

Hello,

Hello,

 

I have an activity "OCH_Activities". "Source_Queue_TXT" and "OCH_Activities". "Target_Queue_TXT".

I want if source and target are the same, that I get the value 1 for example.

I have already tried 

COUNT( CASE WHEN "OCH_Activities". "Source_Queue_TXT" = "OCH_Activities". "Target_Queue_TXT" THEN 1 ELSE 0 END)

but this does not compare the two activities. What would be the correct approach here.

Thanks

2 replies

May 16, 2023 2:26 PM UTC

Hello Rene,

If I understand your problem, your current CASE WHEN query yields the same result without taking into account the IF right? To take into account your IF you should replace the COUNT function by the SUM function, so the PQL will select only the cases where the equality between the activities is fulfilled.

 

SUM( CASE WHEN "OCH_Activities". "Source_Queue_TXT" = "OCH_Activities". "Target_Queue_TXT" THEN 1 ELSE 0 END)

 

I hope this is helpful.

May 17, 2023 11:31 AM UTC

Thank you for your support. It works