Explain what you mean by "external script".
If the records being searched are in a different file than the script that sets the variables to values, those variables are not accessible and you'll need to use a different method to transmit the search criteria to that script.
Please explain where "portal" comes in here. Do you want to find records in the portal's table or do you want to find records in the layout's table that have at least one portal record matching the specified criteria?
The table occurrence context of the layout on which you perform your search will determine which of the two options for results that I just described are produced.
the report page uses a portal to display its data, by external script I only ment that I wasnt using the portal filter, all tables are in a single file.
I am summarising sales for a given date range for selected client from an invoice line items table and displaying them in a report via a portal.
Hope that was clearer.
It's not clear why you are using a portal for this. For printed/PDF'd reports, a portal is often not the best option for your layout design, though sometimes it cannot be avoided.
I'd think you'd want to use a list view layout based on the line items table.
That said, a portal to LIneItems can use either a filtered portal or a relationship based on the filter fields to display line items records for a specific client in a specific date range.
A possible portal filter would be:
Report::StartDate < Invoices::Date And
Report::EndDate > Invoices::Date And
Report::CustomerID = Invoices::CustomerID
This assumes the following relationships: