I want to do calculation and the source data/result is below. I write OQL in dataset, but it seems not work. Let’s take blank situation as example, for City 上海， it should be 17%, but now is 0%. What is the problem and how should I update my OQL statement？ Thanks a lot in advance. Source data and result OQL statement: SELECT MyFirstModule.SourceData/City as City, Count (*) as DN, (sum(CASE WHEN MyFirstModule.SourceData/Comparing_Result ='blank' THEN (1+0) ELSE 0 END):Count(*)*100)+'%' as blank FROM MyFirstModule.SourceData group by MyFirstModule.SourceData/City mendix result
Wang Xiao Dong
Your OQL is now failing because of the second count.
Untested, but this should do it:
FROM MyFirstModule.SourceData sd
sd/City AS City,
Count (*) AS DN,
(SUM(CASE WHEN sd/Comparing_Result ='blank' THEN 1 ELSE 0 END) AS blank
GROUP BY sd/City
And to get the percentage, make the return-entity of executeOQL-activity have an attribute that is not ‘stored’ but ‘calculated’ and make the microflow calculate that percentage.
Tim v Steenbergen
I just wonder why I cannot find blankpercentage in member of change object. Then I cannot do the calculation.