I have a portal that displays several related records, and I'd like a search bar to appear only when on certain tabs. However, I am not entirely sure how to do so as of now. Any suggestions ?
You need to explain what the tabs / the tab control has to do with “the” portal – and maybe describe the intended purpose / workflow a bit more specifically, i.e. in real-world terms.
Okay, so I have multiple tabs that present data about a client. For example, one tab is client, and another is case. The tab, "Client" shows a specific client's info. The other tab, "Case" shows a specific client's case information. I want a search bar to appear when either of these tabs are opened so I can search through records and find the client whose data I want to see.
When you say “tabs”, do you mean the tabs of a native FM tab control object, or something homespun?
And what is the context where this is happening? What is the “specific” client, and where does the portal (portal of what) fit into this?
If you have FM >= 13, you can easily use the Hide if feature to display/hide an object (i.e. your search bar) if a given condition is True / False.
Should your “tabs” be standard tabs, check GetLayoutObjectAttribute() that you could use with named tabs [ e.g. GetLayoutObjectAttribute ( "clientTab" ; "isFrontPanel") ]; if it is something else, you may need to use a trigger to set a flag on enter / exit, which in turn can be evaluated by the Hide feature.
I do apologize for not being so very specific. Yes, the tabs are native FM tab control object. A portal is places within several tabs, both being distinct, and the portal corresponds to the table and field that is designated from the tab name. For example, in the "Client" tab, I have a portal that displays all the client's information that is given -- I want to call different records that contain this information through a search field that can access records that align with a client name. This search bar should be hidden when I am on a tab that does not have any relative info, but I also would like to place the search bar outside of the tab control object as to not take up space.
Hi. I've attached a sample file that I think might do similar to what you are wanting to do and which you might be able to adapt to your situation. It has a menu layout with tab controls that display clients and cases - within each tab control is a portal. A search field on the menu layout (not within the tab controls) allows you to search for Surname - and the portals then display any client records with that surname or any cases records with that surname. If the search field is blank the portals display all records.
You'll see that I've created fields for matching the relationships between the Menu table (where the main layout resides) and the Clients and Cases tables on which the portals are based. In your solution, to ensure you don't break existing elements, you might want to add new Table Occurrences to create this functionality.
Retrieving data ...