88
Views
16
Comments
How to shorten the URL instead of showing all the parameter?
Question
Application Type
Reactive

Hi, I have question, I already read the forum : 
https://outsystems.com/forums/discussion/41357/encrypt-hide-input-parameters-in-url/

But in my case, the requirement is not to store data in database and if possible, avoid encryption but the URL will be too long since the number of parameter that need to pass is around 20 params.


Thank you in advance for any ideas.

2021-11-12 04-59-31
Manikandan Sambasivam

Hi,

you can serialize all parameters into a single string using Base64 encoding. 

  • you need to serialize the parameters into a JSON string.
  • Encode the JSON string using Base64.
  • Pass the Base64 string as a single parameter in the URL.
  • Decode and deserialize the string on the destination page.
UserImage.jpg
Nursyafira binti Jamil

Sorry, if I encode the JSON string to Base64 format, it still will be too long.

2020-11-25 10-45-32
Mostafa Othman
Champion

Hello,

Passing 20 input parameters to screen giving indicator that there is something wrong. I think you need to review your business requirements again and your data model. 

In most cases we need to pass 1,2 or 3 input parameters one of them will be Id or unique identifier that I can use to retrieve data from data entities and fetch other required parameters using aggregates or Data Fetch actions 

2024-12-18 16-06-42
Junaid Syed

Hello,

I agree with Mostafa, 20 parameters is huge number to be passed to a screen, this is not a recommended practice. Usually you would pass couple of parameters that are then used by target screen to fetch the desired information from database.

Probably if you share more details about your use case, you are likely to get better assistance.

Thanks,

Junaid

UserImage.jpg
Nursyafira binti Jamil

I already propose the idea of fetching the desired information from database but the requirement stated that they preferred to not use databases. 

This is the reason why I am seeking assistance on how to best accomplish this task.

UserImage.jpg
liu mingyang

use session while use over 3 parameters.

UserImage.jpg
Nursyafira binti Jamil

I have the idea to use REST API to post the data but I have problem here when I want to retrieve back the data from structure. May I know is there any other opinion on how to solve this or maybe other good ideas?

This is Expose API Server Action

Then this one is for me to retrieve back the data from the structure.


UserImage.jpg
Nani

HI, @Nursyafira binti Jamil 

I never seen a 20 parameters for transfer data between screen's is not a best practices.

If it's a business requirement, Well you can use the clients variables so you can avoid the screen input parameter's and decrease URl.

UserImage.jpg
Nursyafira binti Jamil

Sorry but I still new to OutSystems, may I know if there is example that I can refer too?

UserImage.jpg
Nani

Check the Oml there is a example how to use.

Instead of client variables i will suggest create entity which a stores a temporary data, but you just mentioned that shouldn't use databases.

Your idea on API will not work because data has to store when retrieving back.

Test.oml
UserImage.jpg
Nursyafira binti Jamil

It's okay, thank you for the suggestion.
I am looking for the advise if there is any alternative in order to handle this method instead of creating entity which store the temporary data. 

UserImage.jpg
Nani

Yes, Use client variables, where variable can handle more then 2Mb to 10MB based on the browsers.

Check the pervious message there is a OML with example how to use client variables when navigating to avoid the screen input parameters.

Let me know, if still facing the issue with limited capacity of Client variable.

UserImage.jpg
Nursyafira binti Jamil

May I know if is it possible to use client variable if you want to pass to screen belong to different module?

UserImage.jpg
Nani

Yes, you can do that buy using a client Action and make it has a public "Yes" and you can use it in different modules by adding dependence's.

Batter create a Separate Module for handling client variables for use case different modules.

UserImage.jpg
Nursyafira binti Jamil

Understand and I tried to implement it, this is my client action :


When I debug, there is no problem to pass the data

And how I call back to retrieve back, I only get the default value instead the desired value that I want to pass :

UserImage.jpg
Nani


Without looking into your code i couldn't tell exactly where is the issue.

Better create a separate module and follow below steps.

1.Create a client variable.
2.Create two client actions (To store data & To GetData) make sure both action are public.
3.Use the client action where you required.

Note: Make sure the string size is less then 10MB

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.