Skip to Content

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 07, 2017 at 12:45 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded