JPQL CASE WHEN With different return type then condition field

Hello people,

I am trying to have a report datasource using case … when, but it seems that it won’t work unless the return type is the same as the field in the condition?
I need to return a string from one entity or another depending on a flag.

I have this field:
WHEN e.booleanField = true THEN f.textField
ELSE g.textField
END as “caseField”

But it always throws an error, often an SQL error which has my case statement but with the values missing or substituted with a “?”.
If i replace the textFields with true or false then it executes…

How can i do a case when like this in CUBA?