a month ago - last edited a month ago
Hi Experts,
I am exploring flexible programming model. My requirement is to display a simple chart in my custom page with x-axis(dimension) and y-axis(measures).
I am not using any sum aggregation or grouping the y-axis. Just to display as it(x-axis is type string, y-axis is type decimal(15,2)).
i tried the annotation as below
Annotation.cds:
the output of the chart: [50017] - Invalid data binding
I dont know where i am missing. Please need help
Hi,
try the following code.
using STODashboardService as service from '../../srv/dashboardservices';
annotate service.ZIJS_CDS_TOTAL_TI_COUNT with @Aggregation.ApplySupported: {
$Type : 'Aggregation.ApplySupportedType',
SupportedAggregationMethods: [
'min',
'max'
]
};
annotate service.ZIJS_CDS_TOTAL_TI_COUNT with @ui.presentationVariant: [{
$Type: 'UI.PresentationVariantType',
Visualizations: ['@UI.Chart#PlantVsInitiatives']
}];
annotate service.ZIJS_CDS_TOTAL_TI_COUNT with @ui.selectionVariant: {
$Type: 'UI.SelectionVariantType',
Parameters: []
};
annotate service.ZIJS_CDS_TOTAL_TI_COUNT with @ui.Chart #PlantVsInitiatives: {
$Type : 'UI.ChartDefinitionType',
Title : 'Initiatives Overview by Plant',
Description : 'Displays min and max initiatives per plant',
ChartType : #Column,
Dimensions : ['PLANT'],
DimensionAttributes: [{
$Type : 'UI.ChartDimensionAttributeType',
Dimension: 'PLANT',
Role : #Category
}],
Measures : [
'MinInitiatives',
'MaxInitiatives'
],
MeasureAttributes : [
{
$Type : 'UI.ChartMeasureAttributeType',
Measure: 'MinInitiatives',
Role : #Axis1,
Label : 'Minimum Initiatives'
},
{
$Type : 'UI.ChartMeasureAttributeType',
Measure: 'MaxInitiatives',
Role : #Axis1,
Label : 'Maximum Initiatives'
}
]
};
Explanation:
<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:macros="sap.fe.macros"
xmlns:html="http://www.w3.org/1999/xhtml" controllerName="dashboard.ext.main.Main">
<Page id="Main" title="{i18n>MainTitle}">
<content>
<macros:Chart
metaPath="@com.sap.vocabularies.UI.v1.Chart#PlantVsInitiatives"
entitySet="{path: '/ZIJS_CDS_TOTAL_TI_COUNT'}"
chartTitle="Initiatives Overview by Plant"
chartType="Column">
</macros:Chart>
</content>
</Page>
</mvc:View>
Explanation:
You should also check the following:
Service Binding: Ensure that your OData service is correctly bound and exposed in your SAP Gateway.
Metadata Check: Verify the metadata in the browser to ensure that all annotations are correctly exposed.
Console Logs: Check the browser's console logs for any errors related to data binding or annotation misconfiguration
Greetings
Dom
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i have altered the code as below
View.xml:
<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:macros="sap.fe.macros" xmlns:html="http://www.w3.org/1999/xhtml" controllerName="dashboard.ext.main.Main">
<Page id="Main" title="{i18n>MainTitle}">
<content>
<macros:Chart metaPath="@com.sap.vocabularies.UI.v1.Chart#PlantVsInitiatives" entitySet="{path: '/ZIJS_CDS_TOTAL_TI_COUNT'}" chartTitle="Initiatives Overview by Plant" chartType="Column">
</macros:Chart>
</content>
</Page>
</mvc:View>
annotation.cds:
Final output is achieved using below code in annotations.cds
User | Count |
---|---|
66 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.