1 2 3 Previous Next 64 Replies Latest reply on Dec 8, 2016 8:01 AM by marksealey

    Scripted finds (checkboxes)

    marksealey

      Have taken elements of philmodjunk's sample script steps (Thank you!) for a robust way to script checkbox finds.

       

      How does my test file (attached) compare, please?

       

      Any errors, or misunderstandings?

       

      TIA!

        • 1. Re: Scripted finds (checkboxes)
          philmodjunk

          The key question is does it work for you? You know how it needs to work to meet the needs of your system. Does it do that?

          • 2. Re: Scripted finds (checkboxes)
            marksealey

            It seems to do what it's supposed to.

             

            The syntax is correct, obviously.

             

            But is the structure implemented to do what it's supposed to?

             

            Are there illogicalities, or faulty deployments in the scripts?

            • 3. Re: Scripted finds (checkboxes)
              philmodjunk

              If that were the case, you would not get the results that you need correct?

               

              But the main point is that while we can look at your file, we don't automatically know if the results produced are what you expected or not. Check box based criteria can be used in two very different types of finds--to find only those records where all the specified options are selected or to find all records with any one of those options selected and we won't automatically know which is the result that you need.

              • 4. Re: Scripted finds (checkboxes)
                BruceRobertson

                Your example is extremely simple. And as mentioned; it seems to pass the test for this example.

                 

                But in another thread, there was an example of searching on a data range; and searching for multiple values in a status field, though using the same date range. This requires generating multiple find requests.

                 

                Your file does not accommodate that scenario.

                 

                In addition to Phil's comment in reply #3.

                • 5. Re: Scripted finds (checkboxes)
                  marksealey

                  Yes; thanks - Phil: I want my Find to return any/all records where any one (or more) of multiple (in the real database: what I attached is proof of concept) checkboxes is checked; not where all of them are.

                   

                  Bruce: I don't need dates or multiple values.

                   

                  The 'real' file has checkboxes, each one of which represents a 'category', a 'tag' if you like, representing an attribute of the record. In fact, they're countries and areas of interest and expertise in a glorified/expanded address book.

                   

                  The find must return all records where any one of up to 30 checkboxes is checked… return all the people who - for instance - live in Spain OR Greece OR Italy OR France OR who have an interest in pottery OR (who have an interest in) painting etc.

                   

                  My apologies for not being clearer. I appreciate how you have helped me with what I hope explains what I want to do!

                  • 6. Re: Scripted finds (checkboxes)
                    BruceRobertson

                    "The find must return all records where any one of up to 30 checkboxes is checked… return all the people who - for instance - live in Spain OR Greece OR Italy OR France OR who have an interest in pottery OR (who have an interest in) painting etc."

                     

                    In other words - as addressed by Phil - your simple example file does NOT meet that requirement.

                    • 7. Re: Scripted finds (checkboxes)
                      marksealey

                      Bruce,

                       

                      Doesn't it? I have those four examples of the various combinations of checked and unchecked boxes.

                       

                      It seems to return the right results - include in the Found Set any box (1 or 2) when that box is checked in that record.

                       

                      Can you see a flaw/see that not doing what it's supposed to, please?

                       

                      TIA!

                      • 8. Re: Scripted finds (checkboxes)
                        BruceRobertson

                        It might be better to expand your example to use value lists closer to your real file.

                        You used the word OR in your recent description of your goal.

                         

                        "return all the people who - for instance - live in Spain OR Greece OR Italy OR France OR who have an interest in pottery OR (who have an interest in) painting etc."

                         

                        The use of OR and AND can be confusing.

                         

                        Another way of describing the result I think you are asking for in your query above is:

                         

                        All records with "Spain" checked (whether or not they have pottery or painting checked)

                        and

                        All records with "Greece" checked (whether or not they have pottery or painting checked)

                        and

                        All records with "Italy" checked (whether or not they have pottery or painting checked)

                        etc

                         

                        In your simple example, if your find layout has Box 1 checked and Box 2 Checked, then it seems to me you should see a result where only one record is omitted - the one where both checkboxes are empty.

                        • 9. Re: Scripted finds (checkboxes)
                          marksealey

                          Bruce,

                           

                          Thanks for your advice about Value Lists. Currently the CheckBox set has one ('Y')… that is, 'This box is checked'.

                           

                          Your expanded example wording is exactly what I want to achieve, Yes.

                           

                          It treat is as 'OR' because (in the case of countries) each one person can be assumed only to live in one country (at any one time).

                           

                          So the scripted Find may want to return all those who live in, say, any of those European countries. That really is an OR, isn't it.

                           

                          Similarly, the Found Set wants to include someone who has an interest in 'painting' OR 'pottery' etc, Yes, regardless of where they live.

                           

                          I thought that was what I had constructed with the checkboxes: if a box is checked (regardless of whether or not any other boxes - and eventually regardless of how many (other) boxes - is/are checked), include it!

                           

                          Isn't that what it's doing? Would it perhaps make it clearer if I added box_3, box_4 and added more records with such combinations, do you think?

                          • 10. Re: Scripted finds (checkboxes)
                            BruceRobertson

                            No,  obviously it would not.

                            As I said: use some real values.

                            Say Box 1 is Germany and Box 2 is Italy.

                            Right now you are claiming your result is successful for a person who lives in Germany and Italy.

                            • 11. Re: Scripted finds (checkboxes)
                              marksealey

                              Bruce,

                               

                              When you suggest using real values for the checkboxes, how would that work when what I want to do is detect a Yes or No value for each? Don't I?

                               

                              I imagined that the Found set in FMP will include, say 'Y' (= box checked) for, say, the 'Germany' checkbox and so all the records which contain the Germany checkboxes checked ('X') would be included. Is it not so simple as that?

                               

                              What you're saying to help me is very useful; thanks. It's exactly why I followed Phil's suggestion to post the file - to make sure that my script works as intended.

                               

                              Have I explained what I want clearly enough for you to continue to make suggestions?

                               

                              Essentially, the Found set should return/include any and every record for which any box is checked during the Find operation on the Find layout… the relationships between boxes is unimportant - not least because one person('s record) might have ten of the boxes checked; another's only 1 and some may actually be not checked at all.

                               

                              When I search on those with 'Germany' checked ('Y' or 'X'), all those records are included on Submit. If I also added 'Spain', the Found set would include both Spain and Germany.

                              • 12. Re: Scripted finds (checkboxes)
                                BruceRobertson

                                There are so many things wrong with your proposed setup.

                                But what I don't understand is why even in this very simple example, if you declare Box 1 as Germany and Box 2 as Italy, you claim that your script works when so obviously it does not.

                                Have you actually tried it?

                                • 13. Re: Scripted finds (checkboxes)
                                  marksealey

                                  Bruce,

                                   

                                  Actually, I'm not claiming - it's why I've asked for your help :"-)

                                   

                                  What is not working in my script?

                                   

                                  What other things are wrong - that's just why I've asked you to be kind enough to offer help. Thanks for doing so.

                                   

                                  I followed Phil's example - or so I thought.

                                   

                                  How would you code it, please?

                                   

                                  That would be very helpful…

                                   

                                  Happy to change.

                                   

                                  Have attached a new version - with real values, and three of them

                                  • 14. Re: Scripted finds (checkboxes)
                                    BruceRobertson

                                    Well; I will provide a mod to your file in a moment.

                                     

                                    But once again: you KNOW your script does not work, and we have been over this and over this.

                                     

                                    Given a search for Painting and Ceramics, it does NOT find all the people who like Painting; AND all the people who like Ceramics (four records).

                                     

                                    It only finds people who like both (1 record).

                                    It was the same problem, as described in message 6 and 8, when it was Box 1 and Box 2.

                                    1 2 3 Previous Next