How to reference element of navigation property in detail view? - sapui5

I am trying to get Data from a navigation property to display in my detailview.
Image shows the definition of the entities in sap gateway
The association is a 1:1 association.
If I use the link to the navigation property directly it gives the proper result:
link:
/sap/opu/odata/namespace/PROJECTBUILDER_SRV/PROJEKTSet('00002403')/TechnicalSpecs
result:
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="/sap/opu/odata/namespace/PROJECTBUILDER_SRV/">
<id>/sap/opu/odata/namespace/PROJECTBUILDER_SRV/TECHNICAL_SPECSSet('Test%20Service%202')</id>
<title type="text">TECHNICAL_SPECSSet('Test%20Service%202')</title>
<updated>2021-12-02T13:06:38Z</updated>
<category term="PROJECTBUILDER_SRV.TECHNICAL_SPECS" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<link href="TECHNICAL_SPECSSet('Test%20Service%202')" rel="self" title="TECHNICAL_SPECS"/>
<content type="application/xml">
<m:properties>
<d:Equipment>Test Service 2</d:Equipment>
<d:Pspnr>00002403</d:Pspnr>
<d:Turbine>TurbineName</d:Turbine>
<d:NominalPowerE>2,5 MW</d:NominalPowerE>
<d:NominalPowerM>4 MW</d:NominalPowerM>
<d:RotorDiameter>80 M</d:RotorDiameter>
<d:RotorSpeed>5,92/12 RPM</d:RotorSpeed>
<d:GridFrequency>50 HZ</d:GridFrequency>
<d:GeneratorSpeed>379 RPM</d:GeneratorSpeed>
<d:GearboxRatio>50,6</d:GearboxRatio>
<d:NominalTorque>4700 KNM</d:NominalTorque>
<d:MaxTorque>9800 KNM</d:MaxTorque>
</m:properties>
</content>
</entry>
But in ui5 view the fields stay empty (the getEntity-Method isn't called either) - so I must be referencing it in a wrong way:
The view I am in uses a route to PROJEKTSet and inside this view I am trying to say:
<m:Input value="{/TechnicalSpecs>/Equipment}" editable="false" visible="true" id="DetailEquipment"/>
What is the correct way to get the value "Equipment" of Entity TechnicalSpecs, which has an association with PROJEKT?

Related

How to Add additional columns to links page to ExternalLink types

How to add columns to ExternalLink on the "Links" page on Azure DevOps Workitem ?
Answered : Not Possible see answer below
Pull Request is not like Code Review Request, it's not a work item
type, we cannot see it from the exported process template. So, I don't
think we can customize the columns like the common work item types. –
Andy Li-MSFT
after going through the following links
link1
link2
and trying the workaround discussed here
I have failed to add more columns to links of the type externallink
i have added the following code as described:
<Page Label="Links" LayoutMode="FirstColumnWide">
<Section>
<Group Label="links">
<Control Type="LinksControl" Name="links">
<LinksControlOptions>
<LinkFilters>
<ExternalLinkFilter Type="Build" />
<ExternalLinkFilter Type="Integrated in build" />
<ExternalLinkFilter Type="Pull Request" />
<ExternalLinkFilter Type="Branch" />
<ExternalLinkFilter Type="Fixed in Commit" />
<ExternalLinkFilter Type="Fixed in Changeset" />
<ExternalLinkFilter Type="Source Code File" />
<ExternalLinkFilter Type="Found in build" />
<ExternalLinkFilter Type="GitHub Pull Request" />
<ExternalLinkFilter Type="GitHub Commit" />
</LinkFilters>
<Columns>
<Column Name="System.State" />
<Column Name="System.ChangedDate" />
<Column Name="System.PullRequest.IsFork" />
</Columns>
</LinksControlOptions>
</Control>
</Group>
</Section>
</Page>
But the results still show only the original columns.
The problem is that the field/column you added (<Column Name="System.PullRequest.IsFork" />) is not a valid work item filed/column. The workaround is only available for work item types due to the columns depend on work item fields.
You need to add a valid work item field/column here. We can get all the available work item fields by calling the Get Work Item REST API with parameter $expand=Fields added in the URL from a specific work item.
GET https://{instance}/{collection}/{project}/_apis/wit/workitems/{id}?$expand=Fields&api-version=4.1
For example, the following screenshots shows all the available fields for my Task work item. (It depends on how you defined the fields, if you defined a custom field, you can also see it from the response body.):
After that, we can add the columns (System.CreatedBy and Microsoft.VSTS.Common.Priority for example in this sample)
Then check the behavior in a Task work item:
Please note that, Pull Requests is not a work item type. We cannot get valid work item fields by calling the Pull Requests REST API. In this case, I don't think we can customize the columns like the common work item types.

Unable to create XAML array of views with mvvm:ViewModelLocator

I want to make a xamarin forms carousel view containing 2 custom views. I have this code:
<ContentPage x:Class="MainView" xmlns:mvvm="clr-namespace:Prism.Mvvm;assembly=Prism.Forms" xmlns:views="clr-namespace:Views" x:Name="Main">
<CarouselView>
<CarouselView.ItemsSource>
<x:Array Type="{x:Type View}">
<views:View1 mvvm:ViewModelLocator.AutowirePartialView="{x:Reference Main}" />
<views:View2 mvvm:ViewModelLocator.AutowirePartialView="{x:Reference Main}" />
</x:Array>
</CarouselView.ItemsSource>
<CarouselView.ItemTemplate>
<DataTemplate>
<ContentView Content="{Binding .}" />
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
</ContentPage>
When launching the app, exception is thrown:
Xamarin.Forms.Xaml.XamlParseException: 'Position 80:37. Can not find
the object referenced by Main'
If I just set both views as direct content of the main page, it works fine. What am I doing wrong?
Is there a way to make the collection of views through the MainViewModel?

SAPUI5 Strange data binding behaviour

It's pretty silly problem but I have no idea why is it happening. I heve this in my controller:
this.getView().setModel(this.placesModel, "myCity");
then I set the data with Ajax request to my express RESTFull app and in View.xml
<List items="{path: 'myCity>/people'}">
<CustomListItem>
<VBox>
<Title text="Person:"/>
<Label text="{myCity>/people/name}"/>
<Label text="{myCity>/people/age}"/>
</VBox>
</CustomListItem>
</List>
I have object myCity with few properties. One of them is object people which is array of objects. When I try to list them like that I can see that all my people get listed but without corresponding name and age. Also I find it hard to understend when to use > when / when when >/.
Basic binding syntax with model name is {(model_name)>(path_to_property)}, if you don't have a model name (default model) you need to specify only {path_to_property}.
The initial slash (/) is needed if you don't have a contextbinding. In your case you have contextbinding set on List, so you don't need to use the slash.
Updated code:
<List items="{path: 'myCity>/people'}">
<CustomListItem>
<VBox>
<Title text="Person:"/>
<Label text="{myCity>name}"/>
<Label text="{myCity>age}"/>
</VBox>
</CustomListItem>
</List>
For more information refer to Binding Path.

Insert table in XML-view

I created a table in my controller-function onRoutePatternMatched.
Now I want to bring this table to the view.
This should be done with oTable.placeAt("sample1");
What is the right code to insert it on a specific place in my xml-view?
Home.view.xml
<?xml version="1.0" encoding="UTF-8" ?>
<mvc:View controllerName="ztest.controller.VarConf" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
xmlns:html="http://www.w3.org/1999/xhtml">
<Page>
<content id="sample1"></content>
<content id="sample2">
<Label text="{varConfDet>/chassisnr}" />
</content>
</Page>
</mvc:View>
Error:
sap-ui-core.js:152 Uncaught Error: DOM element with ID 'sample1' not found in page, but application tries to insert content.
put an id on on the page and not on its content aggregation(s): <Page id="myPge">
in Controller call this.getView().byId("myPage").addContent(oTable);
Because content os the default aggregation of the sap.m.Page you could also only call this.getView().byId("myPage").add(oTable);. Also be aware that you might to remove previously added content... Of course, you could also use different panels etc. with different ids and place the table somewhere in there...

Qlikview REST connector pagination namespaced XML

We have a XML file that is on somewebsite and looks in a way like this (confidential parts stripped)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://somewebsite.com/crm/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Accounts</title>
<id></id>
<updated>2016-02-04T08:36:56Z</updated>
<link rel="self" title="Accounts" href="Accounts" />
<entry>
<title type="text"></title>
<updated>2016-02-04T08:36:56Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:Type>A</d:Type>
<d:UniqueTaxpayerReference m:null="true" />
<d:VATLiability m:null="true" />
<d:VATNumber m:null="true" />
<d:Website m:null="true" />
</m:properties>
</content>
</entry>
<link rel="next" href="https://somewebsite.com/Accounts?$skiptoken=guid'ee6bc390-a8ac-4bbd-8a4d-0a1f04ab9bd3'" />
</feed>
We use the new Rest connector to get the data out of this XML file.
The XML has pagination and every 60 entries you can load the next 60 with the link at the bottom of this xml file.
The problem i have is when, in the REST connector, we want to enable pagination with these setting:
Pagination Type: Next URL
Next URL field path:
/*[name()="feed"]/*[name()="link"][contains(#rel,"next")]/#href
It doesn't seem to work...
side note: the XML file has namespaces so i need to target the elements this way instead of /feed/link/...
I'm using Xpath syntax to target the link href, but maybe this is not the way to go? Or maybe the REST connector isn't using Xpath syntax?
Really hope someone can help me!
Actually it turns out that this seems to be due to a "bug" in the "Qlik REST Connector 1.0" so the pagination doesn't work.
But there is a fix for it:
1) Make sure that the Qlik REST Connector 1.0 connect dialog box has the NextUrl set to:
feed/link/attr:href
2) When the SQL has been generated after using the SELECT-button and going through the wizard you have to modify the sub-SELECT that reads like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href" AS href,
"__FK_link"
FROM "link" FK "__FK_link"),
.....
On line 05 you will have to remove the text AS href.
So it should look like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href",
"__FK_link"
FROM "link" FK "__FK_link"),
....
3) Find the LOAD statement that loads from this sub-select with a RESIDENT [MasterREST further down in the load script and make sure that the reference to href is changed to [attr:href] - or else you will get an error message while loading.
Should look like this after the change:
[link]:
LOAD [rel],
[title],
[attr:href],
[__FK_link] AS [__KEY_feed]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_link]);
This worked for me:
/*[name()='feed']/*[name()='link'][#rel='next']/#href
Yours should also work actually, maybe whatever you are using does not agree with double quotes instead of single quotes.