URL length limitation to filter records

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
sacgtdev
Veteran Member
Posts: 75
Joined: 2020-06-10 11:14

URL length limitation to filter records

Post by sacgtdev » 2021-09-20 02:10

There is url length limitation:

When the url was constructed and email to outlook, it tends to be truncated if length exceeded 2048.

In addition, different browser also will put limitation on the url length.

Is there any existing method in appgini, something like a POST method?

I explore this https://blogs.sap.com/2014/04/17/url-le ... -explorer/, but not sure whether it can be implemented in appgini.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: URL length limitation to filter records

Post by onoehring » 2021-09-21 06:10

Hi,

please explain what you are trying to do. Maybe this way we can find a solution.
The document describes a workaround. Probably you could send come cryptic data using GET and do some stuff according to your cryptic data ... but that's poking in the dark, so: What are you trying to do?

Olaf

sacgtdev
Veteran Member
Posts: 75
Joined: 2020-06-10 11:14

Re: URL length limitation to filter records

Post by sacgtdev » 2021-09-21 07:32

For example, I have constructed a url for a filtered records, as follows:

http://localhost.com/abc_view.php?SortF ... lue[18]=57

This url will be hyperlink and automatically send to the user via email so that the recipient can check on the filter records page directly by click on the link. Some email client such as outlook will truncate the url link because it is too long and hence make it broken. Different browser do also have variable limitation on url length.

I am looking for a persistent solution. Do you have any better approach to let user access to a readily custom filtered page?

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: URL length limitation to filter records

Post by D Oliveira » 2021-09-24 09:36

save query string on a temporary file and request string on load with sessionStorage or localStorage

sacgtdev
Veteran Member
Posts: 75
Joined: 2020-06-10 11:14

Re: URL length limitation to filter records

Post by sacgtdev » 2021-09-24 10:28

Hi, Oliveira.

Can you elaborate more or give example/ any external reference?

save query string on a temporary file - if it is temporary, that means it will not be persistent and access in future?
request string on load with sessionStorage or localStorage - request strings is GET to the temporary file?

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: URL length limitation to filter records

Post by onoehring » 2021-09-25 08:12

Hi,

just an idea: You could also build yourself an URL shortener into you application. A simple table that connects a short string with the full URL. Then, check if a shorturl is given and return the long.

Olaf

sacgtdev
Veteran Member
Posts: 75
Joined: 2020-06-10 11:14

Re: URL length limitation to filter records

Post by sacgtdev » 2021-09-25 11:39

That should avoid the link send via email being truncated. A proxy link (shorter) to return the actual link (long). But, the long link will still limited by the browser url's length.

I check on the https://youtu.be/7gMWoVh62wU?t=145. In appgini old version, it actually generate the POST form. May this method will work to replace the GET method if the url string is too long.

I have not try it and not sure whether it will works or not.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: URL length limitation to filter records

Post by onoehring » 2021-09-26 08:09

Hi,

POST can be used from a from in direct exchange with the server. GET can be used to create bookmarks and links that can be exchanged. For your purpose, sending someone a link you are forced to use GET .... but ... you can make AG transform this and handle it yourself:
a) create a short link and save the connection to your desired "what should happen" in some internal table
b) in the /hooks/tablename.php -> _init function, you grab the GET, and make AG filter/show only the records that should be shown according to the "long" link in a)

Somehow complicated, but it should work.
You will always have limitations on URL length as it a standardized value which you as a "simple" developer should take as is and not fiddle around with (just a tip from experience - you will create yourself a lot of extra work).

Olaf

sacgtdev
Veteran Member
Posts: 75
Joined: 2020-06-10 11:14

Re: URL length limitation to filter records

Post by sacgtdev » 2021-09-28 08:11

Thank you for your kind suggestion.

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: URL length limitation to filter records

Post by D Oliveira » 2021-10-08 16:23

what I meant was to get the string in a temporary file so you can retrieve it and apply the filters like this:

Code: Select all

function tablename_init(&$options, $memberInfo, &$args){

/* get data you saved, split it, and insert below accordingly */

addFilter(1, 'and', 1, 'equal-to', 'data'); 


return TRUE;
}


Post Reply