Controling one portal with another

I am new to Servoy and am evaluating before purchasing. I have “Product Group” form. On that form is a portal to “Products” that are in the group. Then a second portal that will show “Sub Product” for the selected product in the first portal. I have gotten as far as creating a global field on the form that will house the id of the currently selected line in the “Product” portal but I can’t get this global to reliably fill in.

I am new to all ofhtis and have searched through the functions in the manual but I know I am missing something obvious. How do I get the value of the id field of the currently selected row in a protal? From there I think I know what to do - set a var to that value and then set my global field to that var.

Thanks for your help!

hi teammascot, welcome to servoy.

I think that to obtain what you are looking for you need to place a button on the portal row that fires a method that stores your global variable. Portals do not have onRecordSelection method

If I can suggest… have also a quick look to tabpanels… it is a very VERY VERYpowerfull tool.

Automazione, thanis for the reply.

I did already use buttons on the portal and assigned them to the method via the action property. This does indeed trigger the method- in fact I was somewhat successful in getting the portal records id field to my Global. I was using something like this in the method:

form.portal.id_field.selectall();
var: new_ID = form.portal.id_field.selectedText();
form.global_id.selectall();
form.global_id.replacetext(new_ID);

Anyway this worked most of the time but on some of the portal rows it would insert the previously selected rows id - so I figured it must be that there needs to be a function that first makes the row active that has been clicked on but I just can’t seem to find that and I am guessing it has to be easier than this.

Is there a way to select the contents of a portal rows field? Then again maybe I am missing the bigger picture and I should be using a different strategy all together.

Thanks again for any help - I really want to solve this so I can move forward in my Servoy journey.

You can try with

globals.gdetail_id = order_to_detail.detailid

where order_to_detail is the relation used by the portal, detailid is the primary key of your detail table, gdetail_id is the global integer variable where you want to store the id of the portal selected row.

Hope this helps

ciao

Thanks Ciao, that worked