5 Replies Latest reply on Feb 18, 2011 11:01 AM by philmodjunk

    Add to Portal via Search Bar and Results Window

    DanielClark

      Title

      Add to Portal via Search Bar and Results Window

      Post

      I ran into this problem while creating some PO's from my PO Layout that I made. Currently, I add parts via a PO Line Items Portal onto a PO Layout. The PO Line Items Portal links to Parts stored in my Parts Inventory table. The way I currently add is by selecting from a drop down list field in the portal called PartID (which links PO Line Items and Parts Inventory via kp_PartID, a primary unique serial number field that gets automatically incremented every time a new part is added to the Parts Inventory table, and displays a second field called PartNumber).

      This drop down list is set up so that when you click on it, a list of values from the PartNumber field can be chosen from, then once one is selected, the PartID is displayed, and all of the other part info gets pulled into the portal. This is an ok way to add parts to my portal, but because some of the ParNumber values are rather long, and some are really similar to others, the drop down list (and pop up menu) is kind of a sloppy way of adding parts to the portal.

      What I would like to do is set up a search bar within the PO Layout with a results window underneath it; this enables one to type in a PartNumber, and it actively searches the Parts Inventory table for that part number. Then, if there is more than one match for what has been typed into the field so far - all of the matches are displayed, and the user can click on the desired part number to add. Then the portal can pull this PartNumber, kp_PartID, Manufacturer, etc.

      Is there any way to do this? Thanks.

        • 2. Re: Add to Portal via Search Bar and Results Window
          DanielClark

          The theory in that is fairly sound - However I ran into a few problems:

          1) When I performed the search (using a brand new database I created with the exact same tables, records and everything), it just showed me all of the Contacts, as opposed to only the ones that matched the name I typed in.

          2) Once I get that to work - your idea is great - but I would like to be able for it to be a little simpler in terms of showing me the results. I don't want to have to pull the user too far from where they're currently performing the find. Can I make the results pop up in an embedded field in the initial layout I'm performing the find? (In your example, it would be like having the results pop up in a small window on Invoices). And if not, can I just have Filemaker pop up a small window that is really dumb - that doesn't show FM's menu bar, or any of the other bells and whistles that are on the normal FM database window?

          Thanks again.

          • 3. Re: Add to Portal via Search Bar and Results Window
            philmodjunk

            1) you've got something wrong there, obviously. The search by name shouldn't find all contacts--just those that match the selected name. In most cases, this will be a single name. Only duplicate names will require additional input from the user.

            2) I've used New Window to pop up the list layout in a floating window with a script that both enters the selected record's ID and also closes the floating window. This window can be set up with the status area hidden, locked and simulating a "modal" dialog so that the user has to interact with the window or at least close it before returning to the main window.

            There are also ways to use a filtered portal to list multiple matches in a list where you can click the desired portal row to add that record's ID to your current record.

            • 4. Re: Add to Portal via Search Bar and Results Window
              DanielClark

              Ok, I actually got it to work. However, because this search method is trying to add records to a portal - it keeps overwriting the same portal record over and over every time I search for a new part. How do I fix this?

              • 5. Re: Add to Portal via Search Bar and Results Window
                philmodjunk

                You can use Go To Portal Row [last]

                but I prefer to avoid interacting directly with a portal. Future layout changes can break such a script.

                I prefer something like this:

                Set variable[$ParentID ; ParentRecord::ParentId]
                Go To Layout [Portal Table]
                New Record/Request
                Set Field [PortalTable::ParentID ; $ParentID]
                Set Field [PortalTable::PartID ; $PartID ]
                Go To layout [original layout]//specify the label where you want to be when this is all done