Executing OQL queries on categorical data field

I wan to execute OQL Query for enumerated variable and then store them in individual variables to display in the report grid. How can i do that.
1 answers

By using Group by on your enumeration-attribute.

See button “count(o.TotalPrice), sum(o.TotalPrice), and group by enumeration” on the OQL playground. Check out the “group by c.CustomerType”, which is an enumeration-attribute.

Or manually copy-paste this OQL into the edit box and click execute: 

select c.CustomerType, count(o.TotalPrice) Ordercount, sum(o.TotalPrice) TotalSpent
from "Sales.Customer" c
join "c/Sales.Order_Customer/Sales.Order" o
group by c.CustomerType;

and you will get the Sales grouped by the enumaration-values ‘GoldCard’, ‘Regular’  and ‘ FirstTimer’: