cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
Active Contributor
0 Kudos

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

former_member227918
Active Contributor
0 Kudos

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.

🙂

Former Member
0 Kudos

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.

former_member227918
Active Contributor
0 Kudos

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 ....... }