[Script] Show/HIde portal
in my layout I'd like to have a button with an attached script that can show/hide a portal of related record in the same layout page. Any suggestion for this?
You would devise a layout with that portal. Then your script uses new window to create the window and go to layout (after new window) to select the layout for it. It's possible to make the floating window "modal" (keeps user from losing floating window back behind main window by clicking on objects in the main window.) You are welcome to examine the scripts in the Known Bugs List database for examples of how this can be done. Please note that the combination of an infinite loop with allow user abort [off] can trap you in a case where you have to use either the script debugger (if you have FileMaker advanced), or a force quit to get out if you don't implement it correctly.
The easiest and most effective is to simply duplicate your existing layout and delete the portal on the duplicate layout. Then create a script to take you to the new layout and another to take you back.
The issue with duplicate layout is that you then have to always remember to make duplicate changes to both layouts so they stay in visual synch. I would suggest instead that you use tab panel. Front default tab would be blank and second tab would have the portal. Select the portal and assign it an object name (Inspector > Position > Name) like Portal.
Have a button above the tab panel with script step of: Go To Object [ Portal ]
Make the labels of the tab panel then only 0 px wide (in tab panel settings) then make the tab panel itself invisible. You will also want to consider what criteria should hide the portal again and possibly use triggers to hide it again as applicable.
Depending on what you need to do with that portal, it may work to use New WIndow to open a small floating, window that displays the portal. With this approach, you click a button to open this window to make the portal appear and then close the window to make it disappear.
PhilModJunk, that will be nice too, how can I display a portal inside the floating window?
New window 
Set variable  //storing the id to retrieve the record and all their correlated
Go to Layout  //the correct layout Enter Find Mode  Set Field  //setting the var in the field Set Error Capture [on] Perform Find 
but the window opened has not performed the search, I have to manually press enter to perform it. What am I doing wrong?
Thanks PhilModJunk for the file but where can I see this script in a bug list?
Hmmm, Sounds like you didn't clear a pause check box on the enter find mode step.
I'd change your script to be:
Set variable  //storing the id to retrieve the record and all their correlatedNew window Go to Layout  //the correct layout Enter Find Mode  Set Field  //setting the var in the field Set Error Capture [on] Perform Find 
I unchecked the button and thee field gets correctly valued (by checking it the field is not set with the variable value)
In the Perform Find/Replace  instruction I set: Without window; Find Next and the id of the table associated to the layout
In the Perform Find/Replace  instruction I set:
Perform FInd/Replace and Perform Find are two very different print steps. Your original example shows Perform Find, not Perform Find/Replace. I don't think Perform Find/Replace will do what you want here.
You are right, I'm sorry, translating back and forth from my italian version made me do the mistake. Thanks
Retrieving data ...