1 2 Previous Next 15 Replies Latest reply on Jan 6, 2016 4:13 AM by director@charlesmoore.org

    Extend Found Set

    director@charlesmoore.org

      I have a database snag.  It is a simple relationship between companies and company types.

       

      Based on the selection of "company type", a value list is dynamically generated of only, say, "Manufacturers".  (Acme, Widgets, and Sprockets)

       

      I need to have different layout for each Company Type.

       

      So in the layout here for "Manufactuers", you can see the value list correctly populates the <company_SEARCH> field with 3 values.

       

      What I need my script to do is go to the selection in <company_SEARCH>, but then extend the found set to include the rest of the "manufacturers", BUT not lose the "place" of the selection.


      So if the user selects "company-1002 Widgets",

       

      The layout will show that record, with ALL AND ONLY the other manufacturers available for clicking back and forth to.

       

      I'm adding a mock up of the database.

       

      THANKS FOR ANY HELP!

        • 1. Re: Extend Found Set
          BruceRobertson

          You're asking for help with scripts that perform finds using the RESTORE feature.

          Therefore they are unreadable to those trying to help you.

          Suggest you first revise your scripts to use explicit scripted finds.

          • 2. Re: Extend Found Set
            BruceRobertson

            Also I note that your search specifier fields aren't global fields.

            • 3. Re: Extend Found Set
              director@charlesmoore.org

              Thanks so much...  I changed these to explicit finds, but the problem persists.  When I try to extend the original found set, I lose the original selection.

               

              Any more hints?

              • 4. Re: Extend Found Set
                davidhead

                You have a Perform Find script step followed by the Extend Found Set script step.

                Remove the Perform Find as that is overriding the original found set.

                 

                (Also in line 5, I would assume you should be using $mfg to set the field since you instantiated that variable.)

                • 5. Re: Extend Found Set
                  BruceRobertson

                  I find your file difficult to understand and I really don't know what result you expect.

                  You might try very explicitly explaining that.

                  But as for extending the find; drop line 9.

                  script.png

                  • 6. Re: Extend Found Set
                    davidhead

                    And you could also do the same thing (an AND search) by constructing a find with two requests:

                    Screen Shot 2016-01-06 at 1.28.04 PM.png

                    • 7. Re: Extend Found Set
                      director@charlesmoore.org

                      Im attaching a file where I disabled Line 9, as you suggested.

                       

                      If you go to the Manufacturers Layout, no matter what selection is made in the <company_SEARCH> field, it always "lands" on ACME.

                       

                      What I need to happen is for the layout to display the selection in the <company_SEARCH>, but include all of the other "manufacturers" in the found set.  The key is that the  selection in the <company_SEARCH> should be visible after the script runs.

                      • 8. Re: Extend Found Set
                        director@charlesmoore.org

                        I guess what I'm trying to do is configure a "find" script to achieve what I would want the Go To Record (calculation) to achieve, but that is limited to integers, so its not helpful for me.

                         

                        Green is visible to user after triggered script runs.


                        Selection:  ACME

                        Found Set Result:.  Acme (Record 1); Sprockets (Record 2); Widgets (Record 3)

                         

                        Selection:  Sprockets

                        Found SetResult:.  Acme (Record 1); Sprockets (Record 2); Widgets (Record 3)

                         

                        Selection:  Widgets

                        Found SetResult:.  Acme (Record 1); Sprockets (Record 2); Widgets (Record 3)

                        • 9. Re: Extend Found Set
                          BruceRobertson
                          I guess what I'm trying to do is configure a "find" script to achieve what I would want the Go To Record (calculation) to achieve, but that is limited to integers, so its not helpful for me.

                          Well; you can't, if you're using strictly FIND features.

                          You're getting warm, but at this point I'm going to suggest you carefully restate your question.

                          • 10. Re: Extend Found Set
                            davidhead

                            OK so I think you need a better data structure. With the data structure you have, you will be continually trying to get a found set of records from all the company records. The total record count will never be a true reflection of the number of manufacturers.

                             

                            So what you can do is to have your company table and another table for manufacturer. For each company that is a manufacturer, it will have a record in the company table and one record in the manufacturer table. This will be a 1:1 relationship. Any layout based on the manufacturer table will always show the right number of records. This structure can also be useful for storing data about the company as a manufacturer. For example, the industry they are in or the product they make.

                             

                            The same structure can be extended for tables for other company types you have like distributor and vendor. Any one company can have either one or no record in each of these tables. If a company was both a manufacturer and distributor but not a vendor, they would have a company record, manufacturer record, and distributor record. Make sense?

                             

                            Here is a sample file based on your data but I have cleared out most of the stuff you don't need and added what you do.

                            • 11. Re: Extend Found Set
                              director@charlesmoore.org

                              Thanks for your patience!

                               

                              I guess what I'm trying to do is configure a "find" script to achieve what I would want the Go To Record (calculation) to achieve, but that is limited to integers, so its not helpful for me.

                               

                              This is what I need to happen.  (Notice: companies not labeled "manufactuers" are ever included in the Found Set.

                              The records highlighted as Green in each instance should be the one visible to user after triggered script runs.


                              Selection:  ACME

                              Found Set Result:.  Acme (Record 1); Sprockets (Record 2); Widgets (Record 3)

                               

                              Selection:  Sprockets

                              Found SetResult:.  Acme (Record 1); Sprockets (Record 2); Widgets (Record 3)

                               

                              Selection:  Widgets

                              Found SetResult:.  Acme (Record 1); Sprockets (Record 2); Widgets (Record 3)

                              • 12. Re: Extend Found Set
                                director@charlesmoore.org

                                Thanks for this thoughtful reply.  I have a habit of severely limiting the number of tables (for various reason, relating to this particular database), so I'm still hoping there might be a clever solution for my <company> table solution!

                                • 13. Re: Extend Found Set
                                  BruceRobertson

                                  What is the user doing that makes you want to achieve this result?

                                  It really sounds likely that something else would be a lot easier and more useful.

                                  If carried out as intended, your original record is now number 5; or 1; or 37 or 102 in the resulting found set - and none of that makes any difference? That seems very surprising.

                                  Nevertheless, the point I am trying to get you to think about is that you know the original record ID; and you know (or can know) the list of IDs for the new found set, which includes (somewhere) the original record ID. Then what is the position of the original ID in this list? And if you ask yourself this question, then what tools enable you to find the answer?

                                  • 14. Re: Extend Found Set
                                    davidhead

                                    Sometimes normalisation is the right (and clever) answer

                                    1 2 Previous Next