8 Replies Latest reply on Jan 7, 2016 9:05 AM by Mike_Mitchell

    Text search on a portal


      I have a portal related by Cartesian Product relationship on my Units Layout.

      I would like to be able to filter/search through the Units, does anyone have any advice on how to go about this?


      I can't create custom functions as I do not own a copy of pro advanced yet.

        • 1. Re: Text search on a portal

          Your question is confusing. You say the portal is on your Units layout, which would imply the portal points to a different table (one other than Units). However, you say you want to search through Units. That can be done simply by performing  Find - which makes me think you either want to search for Units that have a specific match in the related table, or you want to filter the records that appear in the portal. Which is it?

          • 2. Re: Text search on a portal

            The portal is located on a pop-over button in the Inspections layout. The portal is a Cartesian Product of Unit's to display every unit within the system.

            I don't really like the Preform Find function. Also as it is on a pop-over it is not going to work.


            I'm searching for a specific serial numbers within the units table. As once the filtered results get displayed I then use a scripted button to insert the UnitId into UnitsIdFk located in Inspections.

            • 3. Re: Text search on a portal

              So you have a pick list, essentially. That's doable. There are a couple of methods to filter the portal results:


              1) Apply a portal filter.


              2) Modify the relationship to include an additional predicate.


              In either case, you'll likely add a global field to the popover to hold the filtering criteria. Which one you choose will be based on how you want the search to work. You say you're searching for "specific serial numbers". If it's always a complete serial number, then I would go with a utility relationship, because portal filters tend to perform slowly, especially using Cartesian joins, when the number of records starts to climb a bit. However, that might be difficult if you're trying to search for a partial serial number. Depending on how the numbers are formatted, you might not get a match on a partial value, so you might need to use a filter instead.





              • 4. Re: Text search on a portal

                Yes this is what I thought.

                I created a global field for the searching of the serial number and then set the filter to the global field...if that's right.


                And set a text box to the global field where the search can be made.


                But when running a search for some reason it was effecting the InspectionsId and not filtering the Units portal. Maybe the script for my search button is incorrect.

                • 5. Re: Text search on a portal

                  Post your script and filter calculation.

                  • 6. Re: Text search on a portal

                    A filtered portal does not use a script. It uses a calculation.

                    • 7. Re: Text search on a portal



                      Set Error Capture [On]

                      If [not IsEmpty ( Units::s_Serial )]

                           Set Field [Units::Serial Number; Units::s_Serial]

                      End If

                      Perform Find []


                      And I set the portals filter to Unit::s_Serial


                      Unit::s_Serial being the global field.

                      • 8. Re: Text search on a portal

                        You need to have a separate place to store the selected value. You're trying to use the filtering field as a storage location for the selection, which will wind up hosing the filter.


                        Your filter should also look something like this:


                        Units::Serial Number = Unit::s_Serial


                        because a portal filter calculation is a Boolean (either true or false), with records being shown if the calculation is true.


                        So Unit is the parent table, and Units is the related table?


                        It looks like what you're trying to do is find the selected record based on a self-joining relationship. If that's the case, then you need to do something like this:



                          Set Variable

                          Enter Find Mode

                          Set Field ( Unit::Serial Number ; Value: $serial )

                          Set Error Capture

                          Perform Find

                          Set Error Capture

                        End If