Skip to Content

how to Enable aggregation sums in smart table

Hi Experts,

i am new to ui5 and working with the smart table type analytical table, and i want to enable the aggregation sum for a particular column, and also want to enable the average for a particular column when we do group by, any suggestions or reference would be great help

Thanks in adavnace,

Pradeep

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jul 29, 2017 at 07:29 PM

    Little confused: Do you want to do a group by OR enable sum/average of entries in a particular column.

    Regards,

    Sharath

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 30, 2017 at 10:38 AM

    Hi Sharath,

    Thank you for your response, :)

    I have some certain number of Columns, i will take 4 of them as example,

    EVT_DATE, VEHICLEID, TRIPCOUNT, MAXSPEED,

    When i do group by EVT_DATE or VEHICLEID,i should be able to see average speed on MAXSPEED, and and sum of TRIPCOUNT, for each group.

    i was using smarttable with the tableType responsiveTable, now i want to use Analytical Table.

    my code snippet as follows:

    http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m" xmlns:l="sap.ui.layout" xmlns:fb="sap.ui.comp.filterbar" width="100%">

    <App>

    <pages>

    <Page id="page" title="{i18n>title}">

    <content>

    <smartTable:SmartTable id="smartTableId" useExportToExcel="true" tableType="ResponsiveTable" useVariantManagement="true" useTablePersonalisation="true" showTablePersonalisation="true" header="Line Items" showRowCount="true" persistencyKey="vehicleDetails.smartTable" enableAutoBinding="true" beforeRebindTable="onBeforeRebindTableExtension" requestAtLeastFields="VIN">

    <smartTable:layoutData>

    <FlexItemData growFactor="1" baseSize="0%">

    </FlexItemData> </smartTable:layoutData>

    <core:ExtensionPoint name="VehicleTableExtension">

    <Table growing="true" id="viewVehicleDetailsId" growingScrollToLoad="true">

    <headerToolbar>

    <Toolbar>

    <ToolbarSpacer>

    </ToolbarSpacer>

    <Button icon="sap-icon://download" press="onDataExport"/>

    </Toolbar>

    </headerToolbar>

    <columns>

    <Column hAlign="Left">

    <customData>

    <core:CustomData key="p13nData" value='\{"columnKey": "EVT_DATE","leadingProperty": "EVT_DATE","sortProperty": "EVT_DATE","filterProperty": "EVT_DATE"}'/>

    </customData>

    <Text text="{i18n>table_Date}"/>

    </Column>

    <Column hAlign="Left">

    <customData> <core:CustomData key="p13nData" value='\{"columnKey": "VEHICLEID","leadingProperty": "VEHICLEID","sortProperty": "VEHICLEID","filterProperty": "VEHICLEID"}'/> </customData> <Text text="{i18n>tableVehicleNameColumnTitle}"/>

    </Column>

    <Column hAlign="Left"> <customData> <core:CustomData key="p13nData" value='\{"columnKey": "VEHICLE_TYPE","leadingProperty": "MAXSPEED","sortProperty": "MAXSPEED","filterProperty": "MAXSPEED"}'/> </customData> <Text text="{i18n>tableVehicleVehicleType}"/> </Column>

    <Column hAlign="Left"> <customData> <core:CustomData key="p13nData" value='\{"columnKey": "TRIPCOUNT","leadingProperty": "TRIPCOUNT","sortProperty": "TRIPCOUNT","filterProperty": "TRIPCOUNT"}'/> </customData> <Text text="{i18n>tableVillageTrips}"/>

    </Column>

    </columns>

    <items>

    <ColumnListItem type="Navigation" press="onLinePress" id="columnListID">

    <cells>

    <Text text="{path : 'EVT_DATE', type : 'sap.ui.model.type.Date',formatOptions: { style : 'medium'}}"/>

    <Text text="{parts:[{path: 'VEHICLEID'}, {path: 'VEHICLEID'}], formatter: '.formatter.displayFirstOrSecond'}"/>

    <Text text="{path :'MAXSPEED'}"/>

    <Text text="{path : 'TRIPCOUNT'}"/>

    </cells> </ColumnListItem> </items> </Table> </core:ExtensionPoint> </smartTable:SmartTable> </content> </Page> </pages> </App> </mvc:View>

    Add comment
    10|10000 characters needed characters exceeded