I have a relation with some hundred records that I allow the user to query and sort through buttons. At the end, there are typically between 50 and 120 records in the constrained set. I would like a card window that shows the users one field per record (title) of this user-constrained set (not all records) for the user to choose from. If the user clicks on one the record, the card closes and goes to this record in the original window (keeping the current set and sort order).
I am aware I can do this with a card using the current relation in List View. However, I would like to do this with a portal (it looks nicer) but how do I set up a portal that keeps the current sort order and selection?
Hello.
The found set would have to be set up thru something like this:
1. Create a field with global storage, a global field, called "ListIDs", and place it in whatever table you want (I ususally put global fields in their own table). This field will hold a list of the primary keys of the found (and sorted) set of records.
1.5 Create a relationship between this global field and the field from which the data actual data comes:
zSystem::ListIDs_g = YourTable::PrimaryKeyField
*What we're doing is leveraging the concept of multi-key relationships. That is, a list of IDs in a field will relate to all the matching IDs in the child table.
2. Create your portal on a layout where the global field is. This portal will show the records from the multi-key.
3. Back on your table where the found set will be, allow the user to find and sort the records in your script.
THEN, in the same script.
4. Loop through all the records and grab the ID. This can be done with a simple loop or it can be done using a cool subscript called Hyperlist
5. once you've gotten all the ids, set this list of them into that global field.
6. Open the card window.
The multi-key will show all the records with a primary key in the list in that global field. If the global field contains the list:
1
3
4
5
then records with primary key 1, 3 ,4 ,5 will show up in the portal.
I'm curious about your thought that portals look better. I actually do not use portals where I can and instead use list views. Lists are easier to work with and they can be sorted easier and I have complete control over them. Portals are a bit dated looking, actually in my opinion. I use them but I try my hardest to make them look like lists instead of portals.
Feel free to ask any clarifying questions in further posts. I may not have given you everything you need, and without example, some of that above may be confusing. I'll try to put together a small demo.
jb