How do I retrieve data from database? (SAPUI5) -
the graph shown want achieve (i hard-coded values)
in database, status
has 1 of 3 possible category values: pending, available , completed
this think logic is:
- delivery request (count(reqid))
- fulfilled (status= completed)
- notfulfilled (status=pending + available)
i want retrieve values database , have. now, can display bar indicates delivery request. (however 2 lines not showing.)
the following section of code xml file:
<mvc:view controllername "sap.ui.urbanlogi.backoffice.controller.linechart" xmlns = "sap.m" xmlns:core = "sap.ui.core" xmlns:form="sap.ui.layout.form" xmlns:mvc = "sap.ui.core.mvc" xmlns:l= "sap.ui.layout" displayblock = "true" > <app> <page title = "total delivery request"> <panel id = "idlinechart"></panel> <list id='idlist' headertext="selected items" items="{/}"> <standardlistitem title="status: {status}" description=" total number of delivery request: {reqid}" /> </list> </page> </app> </mvc:view>
the following section of code controller:
sap.ui.controller("sap.ui.urbanlogi.backoffice.controller.linechart", { oninit: function () { this.opage = this.byid("idlinechart"); var ojsonmodel = new sap.ui.model.json.jsonmodel("http://lssinh000.sin3.sap.corp:8000/sap_le/lionexpress/volunteer/services/request.xsjs"); ojsonmodel.setdata("http://lssinh000.sin3.sap.corp:8000/sap_le/lionexpress/volunteer/services/request.xsjs", true); ojsonmodel.setdata("http://lssinh000.sin3.sap.corp:8000/sap_le/lionexpress/volunteer/services/request.xsjs", true); this.opage.setmodel(ojsonmodel); var dataset = new sap.viz.ui5.data.flatteneddataset({ dimensions: [{ axis: 1, name: 'date', value: "{startdate}" }], measures: [{ group: 1, name: 'deliveryrequest', value: '{reqid}' }, { group: 2, name: 'fulfilled', value: '{status}' },{ group: 2, name: 'notfulfill', value: '{status}' }], data: { path: "/status" } }); var combination = new sap.viz.ui5.dualcombination({ width: "100%", height: "400px", title: { visible: true, text: 'delivery request' }, dataset: dataset }); this.opage.addcontent(combination); }, onselect: function(oevent) { var aselections = oevent.getparameter("data"); var omodel = this.getview().byid('idlist').getmodel(); (var = 0; < aselections.length; i++) { this._selecteddata.push(aselections[i].data); }; omodel.refresh(); }, ondeselect: function(oevent) { var aselections = oevent.getparameter("data"); var omodel = this.getview().byid('idlist').getmodel(); (var = 0; < aselections.length; i++) { (var j = 0; j < omodel.getdata().length; j++) { if (omodel.getdata()[j] === aselections[i].data) { omodel.getdata().splice(j, 1); break; } }; }; omodel.refresh(); } });
would appreciate if me out here because reason can't :( i'm still pretty new sapui5 , first program i'm building i'm facing lot of errors.
Comments
Post a Comment