Take a look at the portals in the bottom of the layout of this demo file: http://www.4shared.com/file/plr_jbkk/EnhancedValueSelection.html
Do they pull up records in the portal like you'd want?
The scripts in this demo create new records in the line items portal, but they could be modified to display a selected record from the portal instead.
The Demo only show the search by Product Description, is there any way you can add another search field to search by Product ID? I tried duplicating everything (cartesian relationship, script, forumla in filter portala option), but it doesn't seem to work. Am I missing something here?
Yes, it can be done.
Describe how you'd want that to work.
Once search field where data in it is matched to both fields?
Match to all records where the data for product ID matches AND the data for description matches?
Match to all records where the data for product ID matches OR the data for description matches?
When experimenting with such a set up, you may want to use Refresh Window [flush cached join results] as a script step executed each time a search field is updated. If that's all it takes to get things to work, then the basic design is OK, it just takes some creativity to set up an update process that avoids needing this script step (which can result in very slow screen updates in many cases.)
For example, you have two search fields in one layout, one for Product ID and one for Product Description. The user have the option to search based on Product ID OR Product description, OR to use both search field to narrow down the search in case one Product ID has two descriptions (ie, color, material, etc). The portal will filter based on these options.
I think there may need to be a script to distinguish between different search fields.
What do you mean by "one product ID has two descriptions". Does this mean you'd have two product records with the same Product ID but different descriptions? Generally, it's better to have unique product ID's....
Assuming I'm understanding that sentence correctly, you can set up a portal filter expression like this:
Let's call the two global fields: gProductIDSearch and gProductDescSearch.
( IsEmpty ( YourTable::gProductIDSearch ) and PatternCount ( PortalTable::ProductDesc ; YourTable::gProductDescSearch ) ) or
( IsEmpty ( YourTable::gProductDescSearch) and PatternCount ( PortalTable::ProductID ; YourTable::gProductIDSearch ) ) or
( PatternCount ( PortalTable::ProductDesc ; YourTable::gProductDescSearch and PatternCount ( PortalTable::ProductID ; YourTable::gProductIDSearch ) ) or
( IsEmpty ( YourTable::gProductDescSearch ) and IsEmpty ( YourTable::gProductIDSearch ) )
This expression does partial string matching on both fields. You might choose to format gProductIDSearch with a value list of ID's and use a straight = comparison, but the overall expression is the same.
Thanks! It worked. I didn't realized you can do parenthesis in a parenthesis. I see your logic in the calculation. Perhaps it can also be expanded to do more than 2 search fields.
It can be so expanded thought the expression can get pretty hairy. Some developers try to get a bit more order to such a complex expression by using a Case function to break up the "Or" terms into pieces, returning 1 or True as the return value when the expression evaluates as True.