Data Set Question - Mendix Forum

Data Set Question

0

I’m running into an odd error – maybe it’s staring me right in the face, but it seems that, when I add a 3rd attribute in the select statement, no can do. Is there is 2 attribute limit to data sets? I don’t think I saw any reference to this in the doc...

 

this works...

from CIS_PersonCase.PersonCase as objPersonCase
inner join CIS_Case.RootCase_StateModelState/CIS_Ref_Common.StateModelState as objStateModelState
group by objStateModelState/StateModelStateName
select objStateModelState/StateModelStateName as StateModelStateName, count(objPersonCase/CaseIDCIS)as CaseCount
order by objStateModelState/StateModelStateName

 

and this works...

from CIS_PersonCase.PersonCase as objPersonCase
inner join CIS_Case.RootCase_StateModelState/CIS_Ref_Common.StateModelState as objStateModelState
group by objStateModelState/StateModelStateSortOrder
select objStateModelState/StateModelStateSortOrder as SortOrder, count(objPersonCase/CaseIDCIS)as CaseCount
order by objStateModelState/StateModelStateSortOrder

 

but this bombs out with a general error...

from CIS_PersonCase.PersonCase as objPersonCase
inner join CIS_Case.RootCase_StateModelState/CIS_Ref_Common.StateModelState as objStateModelState
group by objStateModelState/StateModelStateSortOrder
select objStateModelState/StateModelStateSortOrder as SortOrder, objStateModelState/StateModelStateName as StateModelStateName, count(objPersonCase/CaseIDCIS)as CaseCount
order by objStateModelState/StateModelStateSortOrder

asked
1 answers
3

The fact that objStateModelState/StateModelStateName  turned bold shows that that is the problem. And the problem is that you are grouping on field StateModelStateSortOrder and adding a column on field StateModelStateName that you do not specify how to aggregate it.

Solution: Add objStateModelState/StateModelStateName to your group by

from CIS_PersonCase.PersonCase as objPersonCase
inner join CIS_Case.RootCase_StateModelState/CIS_Ref_Common.StateModelState as objStateModelState
group by objStateModelState/StateModelStateSortOrder, objStateModelState/StateModelStateName
select objStateModelState/StateModelStateSortOrder as SortOrder, objStateModelState/StateModelStateName as StateModelStateName, count(objPersonCase/CaseIDCIS)as CaseCount
order by objStateModelState/StateModelStateSortOrder

 

answered