Skip to Content
0

SAPUI5 getting URI Parameters

Jan 25 at 07:58 PM

43

avatar image
Former Member

Hi,

I am looking to capture URI parameters using my SAP UI5 application.

I am navigating to this URI
http://someurl.uk.incorg.net:8000/GDMI_N/0RPO/XSAPPS/CORE_KPI/index.html#/em_202_Long_Job_Exceptions/50546445

50546445 = payroll

I want to capture that payroll to then use in a query, how do I do this please?

Any help much appreciated!

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Efim Parshin Jan 26 at 06:00 AM
0

Hi! If inside your app this hash (/em_202_Long_Job_Exceptions/50546445) defined as route, you can use attachRouteMatched of your Router.

manifest.json

...
"routes": [{
            "pattern": "em_202_Long_Job_Exceptions/{payroll}",
            "name": "jobExceptions",
            "target": "jobExceptions"
         }],
"targets": {
            "jobExceptions": {
               "viewName": "jobExceptions",
               "viewLevel" : 1
            }
...

jobExceptions.controller.js

onInit: function () {
		var oRouter = this.getRouter();
		oRouter.getRoute("jobExceptions").attachMatched(this._onRouteMatched, this);
	},

_onRouteMatched : function (oEvent) {
		var oArgs, oView;
		oArgs = oEvent.getParameter("arguments");
                var sPayroll = oArgs.payroll;   

                //use your payroll;
}


Or you can use rough way (not recommended):

var sPayroll = window.hasher.getHashAsArray()[1]; 
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Bang on, thanks buddy!

0
Jun Wu Jan 26 at 03:03 AM
0

try to get 50546445 from url?

Share
10 |10000 characters needed characters left characters exceeded