Group by clouse with collection datasource.

How to use the group by clause with the collection datasource.

Use Value Datasources.

An example from the docs:

<dsContext>
    <valueCollectionDatasource id="salesDs">
        <query>
            <![CDATA[select o.customer, sum(o.amount) from demo$Order o group by o.customer]]>
        </query>
        <properties>
            <property class="com.company.demo.entity.Customer" name="customer"/>
            <property datatype="decimal" name="sum"/>
        </properties>
    </valueCollectionDatasource>
</dsContext>

They can be also configured in Studio.

Thanks, But value Datasource works for read only mode. According to my requirement I want datasource with group by clouse which will be use in datagrid, that has to be create and update as well. Check the code below.


<collectionDatasource id="plan_DatasDs"   
                      class="com.compny.entity.Plan_Data"   
                      view="plan_Data-with-MDPLANUnits-MDMEASURE">   
    <query>   
        <!&#91;CDATA&#91;select e from compny$Plan_Data e&#93;&#93;>   
    </query>   
</collectionDatasource>

The query 'select e from compny$Plan_Data e’
should have group by clouse.

So how do you want to group your data?