how to get the parameter from url?

Hi All,

I need to get the value from url

https://www.abc.com/verysystem?locationid=3&nameid=happy

How can i get locationid and nameid? when OnInitialize?


Thank you

Hi Jing ,

Could you please some more details on what exactly you want to achieve .


Regards,

-PJ-

Halo PJ,


We several of QR code , different QR CODE have parameter locationid=3   or locationid=4 or locationid=5

when scan it will access the websystem to main page.. then get the locationid parameter to auto set the dropdown list location. let say 3 is location AAA, 4 is location BBB, 5 is location CCC.


Example: Lily scan one of the QR code when it is locationid=5.

When access to main page, the location "auto" set as "CCC".




Hi Jing ,

If i understand it correctly , when you scan the QR code you will get the url with query string parameter and from that you need the parameter values.

you can try to parse the url in get the value of parameter .

For example first split your url (https://www.abc.com/verysystem?locationid=3&nameid=happy) by ? and you will get two part 

1. https://www.abc.com/verysystem

2.locationid=3&nameid=happy

again parse the 2nd value by & and put some more logic to get the exact value.

I hope i understand it correctly and the above solution is based on that only , correct me if i didn't understand it correctly .


Regards,

-PJ-

Hi Pj,


I know what you mean.. but i dunno how to work in outsystems enviroment.

Might to share some simple file?


Thank you

Could you please first confirm if my understanding is correct ? i will than create a sample oml and will share with you .


Regards,

-PJ-

Yes, Correct.


Solution

Hi Jing,

I created a sample application as per the solution statement mentioned by Pramod Sir.


Check this out: 

1) Sample Application (For Dynamic URL)

2) Demo ParseURLScreen (as per the usecase)


PFA - includes the .oml solution.


Hope this helps you!


Regards,

Benjith Sam

Solution

Hi Jing ,

You can try the oml which Ben provided , however i created another example just to give you another approach of doing such things.Created a page and on button click wrote some javascript to parse and return the locationid and name id.

I did that on button click but you can use it anywhere.

Regards,

-PJ-

Benjith Sam wrote:

Hi Jing,

I created a sample application as per the solution statement mentioned by Pramod Sir.


Check this out: 

1) Sample Application (For Dynamic URL)

2) Demo ParseURLScreen (as per the usecase)


PFA - includes the .oml solution.


Hope this helps you!


Regards,

Benjith Sam

thanks.. it is working


Pramod Jain wrote:

Hi Jing ,

You can try the oml which Ben provided , however i created another example just to give you another approach of doing such things.Created a page and on button click wrote some javascript to parse and return the locationid and name id.

I did that on button click but you can use it anywhere.

Regards,

-PJ-

Yes,Ur sample very useful for me, because i never use JS in outsystems. I am sure sooner can use for other condition.

Thank you