By "Create an EXE" do you mean that you are creating a runtime copy of the database with FileMaker Advanced?
Changing a layout design whenever needed just to print more related records in a portal isn't actually necessary in a runtime nor in regular FileMaker.
The best option is to set up a list view layout based on the portal's table and print from it. Fields from the parent table can be included on this layout and placed in the header, footer, grand summary or sub summary layout parts. You can perform a find or use Go to related records to pull up just the portal records for a single parent record if that is needed. The Invoices starter solutions use this method to print an invoice so you can open them to see a working example.
Another option is to make the portal many rows tall--larger than you ever expect to need is ideal. Then use the sliding options in the INspector to ste the portal to slide up and to resize the enclosing part. The portal will then shrink down to just the rows needed for the number of records in your portal.
I dont like the List view as it prints all not necessary records.
is their a way to use the portal setup in script?
so that it can automatically fetch the number of records and expand the portal to max records.?
Please read my first post again.
Using list view for printing portal records is routinely done without including unnecessary records. You can perform a find or use go to related records to limit the records to just those that you want to print. You can open an Invoices starter solution and look at how it prints an invoice to see a working example of how this might be done.
And you can dynamically reduce the number of portal rows shown by setting them to slide and re-size. This is not as flexible an option as using a list view layout, but sometimes, your data model won't let you use the first option to get the results that you need. What you describe here should work quite well with the list view model.
You cannot dynamically redesign a layout in any version of FileMaker so you cannot use a script to interact with Portal Setup...
Do you mean that i should go to list view and then print the portal?
For Printing purposes, you need to create a completely new layout or adapt one already found in your file. It must specify your portal's table in layout setup.Please note that you can create as many different layouts as you need in a given database file.
You would select List View for this new or different layout.
To print, you need to both switch layouts from the layout with the portal to this "print" layout and also to pull up a found set of the records listed in your portal. A scripted find can pull up those records: Scripted Find Examples
Or the Go to Related Records script step can pull up just the records in the portal and change layouts all in one go.
Thanks Phil for your help.