Skip to Content
0

UI5:- Adding/passing date as parameter to routing through view binding to display Object view.

Apr 05, 2017 at 03:47 PM

155

avatar image

Hi,

I have downloaded worklist app from sap tutorial and enhanced to pass one more field of type date to Object view. I am getting error as "Invalid URI segment '00:00',Ext='00000000552',Filename='TEST_FILE')'". attached screen shots.

Scenario:- In initial worklist, there are three columns Date, Ext and file name. When user clicks on a item, ObjectView should be displayed.

Just added one more parameter to Object view router settings in manifest.json to accept date as parameter. I could see hash of object view with new parameter of date. But in the background resource URI is coming up as '00:00',Ext='00000000552',Filename='TEST_FILE'.

When I took out the date and leave Ext and Filename then app is running with out any issues.

Thanks,

Srini.

url.jpg (9.1 kB)
backendsap.jpg (124.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Akhilesh Upadhyay Apr 06, 2017 at 07:24 AM
0

I am not going deep into it, but how about this:

1: why you are taking date as a key parameter?, just leave it there and get from model itself using getProperty() in the detail view.

2: or what about replace ':' to some other character while passing thru pattern, and decode that in detail view before further use.

:)

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Akhilesh,

Regarding 1:- Date is part of key for backend oData ReadSet. because of that I am passing the date. Also I am not sure how to access the model of worklist view from detailed view.

Regarding 2:- I was not sure if ":" is the reason for issue. Anyway I will check this just to understand how date type data is effecting when it placed as part of key.

I like your first suggestion but I just don't know hoe to access model of another view.

Appreciate your help.

Thanks,

Srini.

0

first try converting to date type from string, might work, as Jun suggested.

or, using below you can get from model instead of passing via routing pattern

onItemPressed: function(oEvent) {
    this._oRouter.navTo("details", {
        entity: oEvent.getSource().getBindingContext().getPath().substr(1)
    });
}

and in routematched,

_onObjectMatched: function(oEvent) {
   this._sItemPath = "/" + oEvent.getParameters().arguments.entity; // i.e. "GetNameSet(00000000552)"
var RunidExt = this._oModel.getProperty(this._sItemPath + "/Id"); var FileName = this._oModel.getProperty(this._sItemPath + "/Name"); var Rundate = this._oModel.getProperty(this._sItemPath + "/date"); //create key here ....... }
0
Jun Wu Apr 06, 2017 at 04:20 PM
0

sObjectDate is a string,I think. can you convert to date before passing to creatkey

Share
10 |10000 characters needed characters left characters exceeded