Passing multiple selected id in a list to a popup

Hi,

I need to pass the list of Ids to Popup screen. Currently I am using input parameter to pass the list of Ids as Text. But if the ids is more than 300, I am getting the run time error because of query string length.

Please guide me how to pass the list of ids into popup screen.

I would store the Id's in the database and then pass the Id of the record containing the id's to the pop-up screen. Then I would retrieve all the Id's within the preparation phase of the pop-up screen.

Balamurugan N wrote:

Hi,

I need to pass the list of Ids to Popup screen. Currently I am using input parameter to pass the list of Ids as Text. But if the ids is more than 300, I am getting the run time error because of query string length.

Please guide me how to pass the list of ids into popup screen.


Have you tried converting the id list as json and the deprecating it your popup preparation action. 

Hello Balamurugan N,

I think you could just use JSON Serialize in your list and pass that object to the popup input, and then use JSON Deserialize in the popups preparation to retrieve your initial list.


Cheers,

Miguel Marçal


I think JSON will cause the exact same string length issue that OP is currently experiencing. Presuming of course that he currently using a comma separated list. 

But I must say, I'm not sure what string length where are actually talking about. For example; For URL's there is no maximum of string length in the RFC so that wouldn't be it. 

Pranav Pandey wrote:

Balamurugan N wrote:

Hi,

I need to pass the list of Ids to Popup screen. Currently I am using input parameter to pass the list of Ids as Text. But if the ids is more than 300, I am getting the run time error because of query string length.

Please guide me how to pass the list of ids into popup screen.


Have you tried converting the id list as json and the deprecating it your popup preparation action. 


Thanks Pranav Pandey. I will face the same issue when I use the Json also. Problem with the parameter value length.

Vincent Koning wrote:

I would store the Id's in the database and then pass the Id of the record containing the id's to the pop-up screen. Then I would retrieve all the Id's within the preparation phase of the pop-up screen.

Thanks,Vincent Koning. As per my current design all the values in local variables, I can't store the ids in the database. Is there any other way to pass the values. Is it possible to achieve via Local Storage? 


If you are using a mobile app you can surely use Local Storage for this, just make sure to clean up after you have completed your action. If you are using a regular Web App I would try to solve this via a cookie orso. 

Vincent Koning wrote:

If you are using a mobile app you can surely use Local Storage for this, just make sure to clean up after you have completed your action. If you are using a regular Web App I would try to solve this via a cookie orso. 

We are developing the web application. Please let me know once you find the solution.

Thanks in advance.


Hi, you can also use a list record as input parameter and every id is a line of the list or use a session variable to store the id's as a text- the first one can also have the same problem with the parameter length. I would go with the session variable.

Lists are not supported as Input variables and not recommended as Session variables. Not sure how long the string can be for Session variables though.

Strings aren't limited in length. But that doesn't mean it's a good idea to store them there. In general, wanting to pass 300 Ids to a pop-up means your design is bad. You'd only need 300 Ids in a pop-up to show 300 records in a list or the like, and doing that in a pop-up... bad. I'd advise the OP to revise the design.

Balamurugan N wrote:

Hi,

I need to pass the list of Ids to Popup screen. Currently I am using input parameter to pass the list of Ids as Text. But if the ids is more than 300, I am getting the run time error because of query string length.

Please guide me how to pass the list of ids into popup screen.

Ok, I haven't seen this questioned before. Why do you want/need to pass a list of id's to a popup? Maybe you're taking the wrong approach in solving the problem.


Cheers!

Kilian Hekhuis wrote:

Strings aren't limited in length. But that doesn't mean it's a good idea to store them there. In general, wanting to pass 300 Ids to a pop-up means your design is bad. You'd only need 300 Ids in a pop-up to show 300 records in a list or the like, and doing that in a pop-up... bad. I'd advise the OP to revise the design.

Hi Kilian Hekhuis/Armando Gomes,

I have a page to store the Role and Privileges information in same page. When add a new role user can select the privileges also. When user click the Add Privilege button then popup will show all privileges(more than 300) with filter and pagination option. I am refreshing the Role Privilege grid after user click ok button from Popup. When user click add privilege again, I am passing the selected Ids to Popup, because the popup should show already selected privileges. I will save all these information on the main Save.


Please assist me how to implement this.  


I still think that using the database for transferring this information is the best method. Can you go a bit more in depth on why this isn't a working method for you?  

Even by having a table "Temp" with one property names "Value" of type Text would solve this problem. Simply store the ID list in the temp table in you main screen. Pass the ID of the record to the pop-up and retrieve the data there in the preparation phase. When you close the pop-up via the notification process you can then delete the record.

But I would personally seek the solution with a more structural database design so that you would run into this problem at all. 


Balamurugan N wrote:

Kilian Hekhuis wrote:

Strings aren't limited in length. But that doesn't mean it's a good idea to store them there. In general, wanting to pass 300 Ids to a pop-up means your design is bad. You'd only need 300 Ids in a pop-up to show 300 records in a list or the like, and doing that in a pop-up... bad. I'd advise the OP to revise the design.

Hi Kilian Hekhuis/Armando Gomes,

I have a page to store the Role and Privileges information in same page. When add a new role user can select the privileges also. When user click the Add Privilege button then popup will show all privileges(more than 300) with filter and pagination option. I am refreshing the Role Privilege grid after user click ok button from Popup. When user click add privilege again, I am passing the selected Ids to Popup, because the popup should show already selected privileges. I will save all these information on the main Save.


Please assist me how to implement this.  


This is fairly simple then. You're retrieving the privileges from somewhere, right? (I'll assume the database). What you should do is query those same privileges in the preparation of the popup.

How does this work? You'll pass as an input parameter to the popup the role id that you're changing privileges. You'll then get, on popup preparation, the privileges. And when successful updating, you'll notify/raise an event so you can refresh the page that opens the popup.

What does it sound like?


Hi Balamurugan,

The typical use of a pop-up is to allow editing and saving information; having temporary, unsaved data, editing it through a pop-up and saving it via the main screen is an unusual paradigm, and I would advise against it. Instead, use the more typical method of adding a Save button to the pop-up, so you can retrieve the current priviliges in the Preperation, and you needn't pass anything to the pop-up.

However, if you really must use the way you described, using a temporary table is I think the only sane solution. But this will require some extra housekeeping, like deleting the records you created in the Save action of the main screen.

Armando Gomes wrote:

Balamurugan N wrote:

Kilian Hekhuis wrote:

Strings aren't limited in length. But that doesn't mean it's a good idea to store them there. In general, wanting to pass 300 Ids to a pop-up means your design is bad. You'd only need 300 Ids in a pop-up to show 300 records in a list or the like, and doing that in a pop-up... bad. I'd advise the OP to revise the design.

Hi Kilian Hekhuis/Armando Gomes,

I have a page to store the Role and Privileges information in same page. When add a new role user can select the privileges also. When user click the Add Privilege button then popup will show all privileges(more than 300) with filter and pagination option. I am refreshing the Role Privilege grid after user click ok button from Popup. When user click add privilege again, I am passing the selected Ids to Popup, because the popup should show already selected privileges. I will save all these information on the main Save.


Please assist me how to implement this.  


This is fairly simple then. You're retrieving the privileges from somewhere, right? (I'll assume the database). What you should do is query those same privileges in the preparation of the popup.

How does this work? You'll pass as an input parameter to the popup the role id that you're changing privileges. You'll then get, on popup preparation, the privileges. And when successful updating, you'll notify/raise an event so you can refresh the page that opens the popup.

What does it sound like?


Hi Armando Gomes,

I will have the selected privileges in the DB. Everything in the Main page local variables. I will save all the information in Main Save. So I cant do it like that.


Kilian Hekhuis wrote:

Hi Balamurugan,

The typical use of a pop-up is to allow editing and saving information; having temporary, unsaved data, editing it through a pop-up and saving it via the main screen is an unusual paradigm, and I would advise against it. Instead, use the more typical method of adding a Save button to the pop-up, so you can retrieve the current priviliges in the Preperation, and you needn't pass anything to the pop-up.

However, if you really must use the way you described, using a temporary table is I think the only sane solution. But this will require some extra housekeeping, like deleting the records you created in the Save action of the main screen.

Hi Kilian Hekhuis,

Is it possible to use the session variables instead of temp table concept?


So you have volatile data on your parent screen, you want to change volatile data on the popup window and then save that volatile data on your parent's screen save action?

I don't know the specifics of the implementation, but I would bet on a design issue here.

Armando Gomes wrote:

So you have volatile data on your parent screen, you want to change volatile data on the popup window and then save that volatile data on your parent's screen save action?

I don't know the specifics of the implementation, but I would bet on a design issue here.

Hi Armando Gomes,

I want to save the Role Information along with privileges. I have more than 300 fixed privileges. When create a new role, I can choose the privileges from privileges master data. 

May I know how you will design for this? 


See my previous answers.

Hi Balumurugan,

You could use a Session Variable, but it's a dirty work-around. You shouldn't want to, like Armando and I already said.