This should solve your issue. You need to cast the data type:-
SELECT
A/AppName as AppName,
A/Function as Function,
case
when A/Status = ''Green'' then cast(''Up'' as String)
else cast(''Down'' as String) end as AppStatus,
Count(*) as StatusCount
FROM Dashboard.APP_STATUS As A
where A/AppName = 'ETD'
GROUP BY A/AppName, A/Function, A/Status
Hi,
Did you try changing the double quotes in the CASE expression to single quotes?
Regarding the other question, Non Persistent Entity objects are kept in the memory of the client so they are not on the database server. For more information: https://docs.mendix.com/refguide/transient-objects-garbage-collecting.
Cheers,
Jeffrey
Your mishap is in the last GROUP BY A/AppName, A/Function, A/Status
The last name should be AppStatus since that is what you aliased it to
Btw. Just to show the single quotes, on https://mydemoversion8-sandbox.mxapps.io/p/OQL this works fine:
SELECT ID, FirstName, LastName,
(case when C/FirstName = 'Savitha' then 'Up' else 'Down' end) as AppStatus
FROM Sales.Customer as C WHERE Name = 'Swathi'
*Editted*
Just now noticed: Your doublequotes around Green and Up and Down are actually two single quote’s every time. That won’t get understood. Change those.
Also try, just to experiment and get to working oql’s:
SELECT (case when A/Status = 'Green' then 'Up' else 'Down' end) as AppStatus
FROM Dashboard.APP_STATUS As A
GROUP BY AppStatus
if need be followed by LIMIT 5
I tried with single quoted but getting below error . This time I tried even without case statement.