One of the simplest ways is,
make a conditional value list of primary key of portal table
then make a unstored calculation field on parent (layout source) table as ValueListItems ( Get(Filename) ; "valuelistName" )
then make another relationship using the calculation = primary key
then change the portal to show related records from this new relationship.