I have a table binding and consuming the publicly available OData service from the ES4 SAP system. My root entity set is ProductSet and it has 2 navigation properties: ToSupplier and ToSalesOrderLineItems.
I am able to issue the $expand parameter in the table bindings as follows, but could you please assist me in how I can pass both navigational properties so that the OData service expands both ToSupplier + ToSalesOrderLineItems?
<Table items="{
path: '/ProductSet',
parameters: {
expand: 'ToSupplier'
}
}">
expand: "ToSupplier,ToSalesOrderLineItems"
If "ToSupplier" was a parent of "ToSalesOrderLineItems" then it would look like this:
expand: "ToSupplier/ToSalesOrderLineItems"
Related
I created an EntityType in my gateway project. How can I bind that value to a list in SAPUI5?
<List id="id1" mode="{path: 'ODataManifestModel>EntitySetForBoolean', formatter: 'Formatter.formatForBoolean'}""
items="{..}"
so I define in my manifest JSON the gateway service and call it ODataManifestModel. Now I'd like to bind that value from the booleanProperty and depending on that value change the mode of my list. All that is clear to me how to do but somehow I think I am not binding it correctly. Because with that I am not sure how the frontend will know that I was to use that specific property. I also tried something like this:
<List id="id1" mode="{path: 'ODataManifestModel>EntitySetForBoolean>booleanProperty', formatter: 'Formatter.formatForBoolean'}""
items="{..}"
but that didn't work either, what I am doing wrong here?
'ODataManifestModel>EntitySetForBoolean>booleanProperty'
A few things:
your screenshot is probably wrong because you always need the entitySet name that can be found in the "folder" Entity Sets not the Entity Type. Although your name looks correct.
you have to bind one element of the entitySet (array) to the mode property specifying it with its defined key in SEGW -> your entitytype needs at least one key field. You cannot acces oData entitSet elements in an OdataModel with an index
you need an absolute path if you are referencing the entitySet, means after model> it must start with /. Alternatively in your controller init method after metadata loaded, bind one element to the whole view
var that = this;
this.getOwnerComponent().getModel().metadataLoaded().then(function() {
that.getView().bindElement({path:"/EntitySetForBoolean('1234')" });
}) to use relative binding in the view (not starting with /)
the path within the structure uses / instead of >
Absolute Binding:
"ODataManifestModel>/EntitySetForBoolean('1234')/booleanProperty"
Or if the element is bound to the view or a parent container object in the view, you can use a relative path:
"ODataManifestModel>booleanProperty"
mode property from ListBase can have a the following properties (None, SingleSelect, MultiSelect, Delete) and it is applied to all the list elements
Am assuming your service looks similar to this via URL, there is no sample data provided in your question: Northwinds oData V2.
Open preview in external window
Here am using the Products Entity set.
//manifest.json
"dataSources": {
"ODataManifestModel": {
"uri": "path_to_your_service",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "",
"annotations": []
}
},
..."models": {
"ODataManifestModel": {
"type": "sap.ui.model.odata.v2.ODataModel",
"dataSource": "ODataManifestModel"
},
..
}
//view.xml
<mvc:View controllerName="sap.otuniyi.sample.Master" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" xmlns="sap.m" xmlns:semantic="sap.m.semantic">
<semantic:MasterPage id="page" title="Contents">
<semantic:content>
<List items="{ODataManifestModel>/Products}" mode="SingleSelectMaster" noDataText="No Data Available" growing="true" growingScrollToLoad="true" selectionChange="onSelectionChange">
<items>
<ObjectListItem title="{ODataManifestModel>ProductName}" type="Active" icon="sap-icon://user-settings" press="onSelectionChange" />
</items>
</List>
</semantic:content>
</semantic:MasterPage>
</mvc:View>
I have a power bi report which i am embedding on my web application.
Is there is anyway that is can embed directly a drill down view of the report?
in short i want to open the report in drill down mode on.How can i do this programmatically.
I am using dot net mvc for my web application.
Yes, that is possible (assuming that you want to apply a "default" filter in your report). When you embed the report, you can add a list of filters to your embedConfig (documentation):
var embedConfig = {
...
filters: [...]
};
A single filter, in the list of filters, can look like the following (documentation):
const myFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Table1",
column: "Column1"
},
operator: "In",
values: ["A"]
};
In which case you specify the filters in embedConfig according to
filters: [myFilter]
However, note that this is not a secure way to prevent users from seeing data, a user can easily, using javascript, remove the filter and gain access to all the data.
I made a Master-Detail application in Web IDE with SAPUI5.
I connected my application to an OData service (V2). The connection parameters have been stored in manifest.json.
I want to prevent my UI5 application from using $batch requests.
I know how to use the following code to disable batch request for a particular request:
var oDataModel = this.getModel(); // sap.ui.model.odata.v2.ODataModel
oDataModel.setUseBatch(false);
But the problem is that I can not use this in onInit function.
Can I set some parameter in manifest.json to disable batch request in general and even when the program is loading it does not use $batch?
You should be able to add parameter useBatch to the settings of your model. According to the documentation (section /sap.ui5/models) these settings will be passed to the constructor.
{
"sap.ui5": {
"models": {
"yourV2ODataModel": {
"dataSource": "yourDataSource",
"settings": {
"useBatch": false
}
}
}
}
}
The availability of component models in onInit has been discussed here several times. See the application init process to see why they are not available.
Well you could to it in the onInit function. But like this:
var oDataModel = this.getOwnerComponent().getModel();
oDataModel.setUseBatch(false);
Go to Component.js
on its "init" method:
this.getModel("yourDesiredModel").setUseBatch(false)
I'm using breeze 1.4.11 with Web Api and EFContextProvider
on client after metadata fetched I extend entity type:
var addressStringProperty = new breeze.DataProperty({
name: "addressString",
isUnmapped: true
})
metadataStore.getEntityType('Account').addProperty(addressStringProperty);
this property is computed and used only on client
after entitymanager.saveChanges([accountEntity]) I see on server side in contextprovider.BeforeSaveEntity that entityInfo.OriginalvaluesMap contains Key "AddressString" with Value == null.
same thing with extending entity like:
var accountCtor = function() {
this.addressString = ko.observable()
};
metadataStore.registerEntityTypeCtor('Account', accountCtor);
How to omit this behaviour?
It's a good question and probably an oversight. I'll add it as a new bug, but... just out of curiousity, why is this problematic for you?
I've implemented a custom DataService adapter for BreezeJS - I wanted to use Breeze with a RESTful back end service (not OData or ASP.NET Web API).
So far - decent results after a learning curve.
I'm having an issue that when I call save changes - afterwards my entities on the client do not get marked as 'Unchanged'. They keep the same entityState.
I assume it has something to do with the success handler of the AJAX request to the backend service (looking at the source code to the WebAPI adapter):
success: function(data, textStatus, XHR) {
if (data.Error) {
// anticipatable errors on server - concurrency...
var err = createError(XHR);
err.message = data.Error;
deferred.reject(err);
} else {
// HACK: need to change the 'case' of properties in the saveResult
// but KeyMapping properties internally are still ucase. ugh...
var keyMappings = data.KeyMappings.map(function(km) {
var entityTypeName = MetadataStore.normalizeTypeName(km.EntityTypeName);
return { entityTypeName: entityTypeName, tempValue: km.TempValue, realValue: km.RealValue };
});
var saveResult = { entities: data.Entities, keyMappings: keyMappings, XHR: data.XHR };
deferred.resolve(saveResult);
}
},
It looks like the response includes an array of 'Entities'. What do these 'Entities' look like? It echoes what the client sent with an updated entityAspect.entityState value (server responses with 'Unchanged')?
Is that what should be passed into the deferred.resolve call?
I've got a working solution for this.
In a nutshell here's what is required for the object that is passed to the
deferred.resolve(saveResult);
Call in the success handler of the save change AJAX request.
Server response should include information about how to map from the client generated id to the server generated id (if the server generated one). This can be one keyMapping property returned in the response (like the Breeze API controller does) or what my service does is return a keyMapping property as a child property of a particular resource
The client code should create an array of objects that look like:
{ entityTypeName: "fully qualified entity type name",
tempValue: "client generated id",
realValue: "server generated id"
}
this array is the keyMappings property of the saveResult object
the entities property of the saveResult object is a flat list of all the entities that were modified from the server. Because of the design of my service API, it can return an entity, and child entities embedded in it, which I had to traverse and pull out into a flat list. Additionally these entity objects should be 'raw' and not include the entityAspect property or anything Breeze might interpret as a 'real' entity.
Also - something that can also be helpful is to look at the new sample from the Breeze folks - the MongoDB Breeze sample. They've implemented a custom dataServiceAdapter that hooks up their NodeJS/MongoDB backend. That provided some additional insight as well.
Good luck!