cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Routing with multiple values

Hi all,

I have a data source where entries are identified not by a single key attribute but by a (possibly) large number of attributes. The data is available in OData format. I want to display that data in the "SAP Fiori Worklist Application". However, navigating to a detail view doesn't work, because I don't know how to pass multiple values from the worklist-controller to the detail-controller. All samples and tutorials I found only work with one value.

Here are some code snippets:

This is from the worklist-controller. I want to pass these two values to identify the entry and navigate to the corresponding detail page.

_showObject: function(oItem) {

    var oCtx = oItem.getBindingContext();

    this.getRouter().navTo("object", {
        G_DEVICE: oCtx.getProperty("G_DEVICE"),
        G_CREATED: oCtx.getProperty("G_CREATED")
    });
},

In the detail-controller, I'm retrieving the values and binding the view

_onObjectMatched : function (oEvent) {
    var args = oEvent.getParameter("arguments");
        
    var device = args.G_DEVICE;
    var created = args.G_CREATED;
                
    this.getModel().metadataLoaded().then( function() {
      var sObjectPath = this.getModel().createKey("T_IOT_DA496D4F2BBE1E39BF4F", {
         G_DEVICE : device,
         G_CREATED : created
       });
       this._bindView("/" + sObjectPath);
     }.bind(this));
},

However, I do not know how to modify the manifest.json accordingly. Right now, it is as following which is obviously wrong.

{
  "pattern": "T_IOT_DA496D4F2BBE1E39BF4F/{G_DEVICE}",
  "name": "object",
  "target": ["object"]
}

How can I modify the pattern accordingly? It should also work for more than two variables.

Thank you very much for responding!

Accepted Solutions (1)

Accepted Solutions (1)

former_member187007
Active Participant

Hello Ulrich,

I don't know if this could help you but in one app that I made this was the way to do this in manifest.json file:

{
   "pattern": "DetScale_S3/{MillTypeId},{PorcMaxEst}",
   "name": "DetScale_S3",
   "target": ["DetScale_S3"]
}

Hope this could be what you're looking for.

Jhon Jairo.

Hello Jhon Jairo

it's so easy! Thank you very much!

Regards,

Ulrich

Answers (0)