I have a list of items in a form. Some of the fields are updateable. The foundset for the form is set to multiselect.
I would like for the user to be able select some items on the form, update a field on one of the records, and be able to tell Servoy to update the rest of the selected records for me.
From my reading of getFoundsetUpdater, it seems that I have 3 options…
update all of the records in the foundset
update a portion of the foundset, say 5 records starting from the selected record
“safely” loop through the foundset starting with the selected record.
Now, I can use something like getSelectedRecords to “grab” the records that I want to update. So, is that telling me that the correct solution is option 3, where I would use getSelectedRecords to put the records, say, into an array, and then loop through the array to do the updates, finishing with a fsupdater.performUpdate() sort of thing?
Is there a “best practice” for something like this?
As always, any guidance you might provide is greatly appreciated.
Out of curiosity, how can the user multi-select records, then gain focus on one particular field of a record and enter a value while maintaining the multi-select?
I would think that you would “lose” the multi-select once a particular field gains focus.(?)
Yes, you’re right about that. The actual order is more like…
The user updates a field on a record of their choice. Let’s say it’s one of 10 records that they want to update from a list of 50.
They user then does their multiselect of the 10 records.
They right-click on the field that they updated, which pops up a popupmenu that lets them select an option for “update these records to have this value”. In my tests so far, the multiselect does continue to “hold” during the right-click.
What I’m trying to figure out now is the correct/best way to accomplish the group update. And, trying to turn that logic into a global function that I can attach to any field I’d like to have work this way. I know that I can pass the form name with controller.getName(), but I haven’t seen the way yet to get the name of the field I’m on in a generic manner. I can pass the name directly through a parameter if I have to, but it’d be slicker if I could just have the function figure that out for itself. I’ve been working with Servoy for a little while now, so, while I’m getting better, I still miss obvious things. I know where to look for the most part; it’s just that there’s so much to look at. So, I come here and ask, hoping that some more knowledgeable person will show mercy on my poor little Servoy soul and help me out .