cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Case Statement issue in cds view

former_member594288
Participant
0 Likes
3,143

Hi,

I have a cds view with below case statements. Like this, i have so many case statements based on same condition. Is there any way to exclude this case statements many times because it is impacting performance of the cds view. Any suggestions.

case when low is not null or low is not initial

then OpenQtyValue* -1

else OpenQtyValue

end as OpenQtyValue,

case when low is not null or low is not initial

then conv_openqtyvalue* -1

else conv_openqtyvalue

end as conv_openqtyvalue,

View Entire Topic
BhargavaTanguturi
Active Participant

Hi, If u have the same condition for many case statements then better go with UNION ALL


like:
select from myTable {

OpenQtyValue - 1 as OpenQtyValue,

conv_openqtyvalue -1 as conv_openqtyvalue

} where low is not null or low is not initial

UNION ALL

select from myTable {

OpenQtyValue,

conv_openqtyvalue

} where low is null or low is initial