on 10-26-2017 5:09 AM
Hi Experts,
I am very new to Fiori and UI5.
I am able to generate a simple fiori chart with JSON data defined inside my View1.controller.js. But when I am trying to connect to my Bex query and display it as a chart, I am unable to do so.
I have 3 items basically
Index.html looks like
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title>helloworld6</title>
<script id="sap-ui-bootstrap"
src="../../resources/sap-ui-core.js"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_belize"
data-sap-ui-compatVersion="edge"
data-sap-ui-resourceroots='{"helloworld6": ""}'>
</script>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script>
sap.ui.getCore().attachInit(function() {
sap.ui.xmlview({
viewName : "helloworld6.view.View1"
}).placeAt("content");
});
</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
XML view look like
<mvc:View controllerName="helloworld6.controller.View1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
xmlns:viz="sap.viz.ui5.controls"
xmlns="sap.m">
<Toolbar>
<ToolbarSpacer/>
<Title text="SEPOS APP"/>
<ToolbarSpacer/>
<Button icon="sap-icon://action" press="onPress" ariaLabelledBy="actionButtonLabel"/>
</Toolbar>
<viz:VizFrame xmlns="sap.viz" id="idcolumn" width="100%">
</viz:VizFrame>
</mvc:View>
And the View1.controller.js looks like
sap.ui.define([
"sap/m/MessageToast","sap/ui/core/mvc/Controller"
], function(MessageToast,Controller) {
"use strict";
var PageController = Controller.extend("helloworld6.controller.View1",{
onInit: function(){
// 1.Get the id of the VizFrame
var oVizFrame = this.getView().byId("idcolumn");
var oDataSetBex = new sap.viz.ui5.data.FlattenedDataset({
'dimensions' : [{
'name' : 'Month and Year',
'value': "{A0CALWEEK}"
}],
'measures':[{
'name':'Sales',
'value':'{A00O2TPJXEBUT4F4UBQXI2U4EQ}'
}],
'data': {
'path':"/OE_SD_FIORI_APPResults?$select=A0CALWEEK,A00O2TPJXEBUT4F4UBQXI2U4EQ&$top=3"
}
});
var feedPrimaryValues4 = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid' : "primaryValues",
'type' : "Measure",
'values' : [ "Sales" ]
});
var feedAxisLabels4 = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid' : "axisLabels",
'type' : "Dimension",
'values' : ["Month and Year"]
});
oVizFrame.setDataSet(oDataSetBex);
var oDataBExModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZODSP_SEPOS_DATA_SRV/");
oVizFrame.setModel(oDataBExModel);
oVizFrame.addFeed(feedPrimaryValues4);
oVizFrame.addFeed(feedAxisLabels4);
oVizFrame.setVizType('bar');
},
onPress:function(){
MessageToast.show("Button Pressed");
}
});
return PageController;
});
Am I missing something? Any help is appreciated.
Regards,
Arpan
Hi,
Have you finally found a solution?
If yes, can you please share and I will assign u all the points
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.