cancel
Showing results for 
Search instead for 
Did you mean: 

Ho w can I do to combine two columns into one and use this whole column as where condition

0 Kudos

I am referring to URL:

https://cap.cloud.sap/docs/java/query-api

Please get back to me on the following feedback:

For EX,

I want to use below CQL to combine two columns into one column, and put into In statement. How can I do this?

Select.from(Test.class).where(t -> (t.id() + t.name()).in(["0001Test1","0002Test2"])


Accepted Solutions (0)

Answers (1)

Answers (1)

robinjayasinghe
Employee
Employee
0 Kudos

You can easily build a CDS view over your entity that combines both columns. The second link already shows (it's linking a bad practice in the performance modeling guide) that is not the best way to model your requirement. You will run into performance problems resulting in high CPU/memory costs.

As an alternative you you could introduce an additional column for the combined value to your entity. Then, you add a @before handler for your entity that takes both source elements and joins them to the resulting combined element.