6 Replies Latest reply on Aug 20, 2013 5:31 AM by Kaps_1

    Inconsistent Find Results

    Kaps_1

      Title

      Inconsistent Find Results

      Post

           I am trying to determine why my script returns an empty found set, yet when I perform the steps outside the script I get the correct results. The screenshot below shows my script. i am trying to the first 3 steps - wanting an AND result i.e :-

           1. include in email marketing = "YES" AND

           2. find all those records where the membership status = "VISITOR" AND

           3. contacts : visitor search  profession =1

            

           where :-

           visitor search  profession = If(FilterValues(Profession;Export fields for visitors::Visitors Profession)>0;1;0)

           so that:-

           Export fields for visitors:Visitors Profession  is a delimited list such as :-

           Mortgage Broker ¶ Accountant ¶ Web Designer

           and Profession is the contacts actual profession. So a member is found if they have a matching profession, are a visitor and also included in email marketing.  However the script gives a blank result - can anybody tell me why ? thanks

           regards

           Kaps

            

            

            

            

      bni_7a.png

        • 1. Re: Inconsistent Find Results
          philmodjunk

               Your If steps refer to fields while in FInd mode. In find mode, all fields are empty unless they are fields with global storage.

               And I think your calculation field should be written as:

               If(Not IsEmpty ( FilterValues(Profession;Export fields for visitors::Visitors Profession ) );1;0)

               As written, you are comparing a list of return separated text values to the number 0 which isn't likely to evaluate correctly.

               It can be simplified to:

               Not IsEmpty ( FilterValues(Profession;Export fields for visitors::Visitors Profession ) )

               and you'll still get the same results.

          • 2. Re: Inconsistent Find Results
            Kaps_1

                 Thanks. I am confused. I have changed the definition of :-

                 visitors search profession to :-

                 If(not IsEmpty ( FilterValues(Profession;Export fields for visitors::Visitors Profession ) );1;0)

                 as you seem to suggest.

                 However, I still get a blank result - what am I doing wrong ? I dont understand the significance of:-

                 "In find mode, all fields are empty unless they are fields with global storage.".

                 Do I need to write my find steps in  another way ? thanks

                 regards

                 Kaps

                  

                  

            • 3. Re: Inconsistent Find Results
              philmodjunk

                   Actually, I suggested that you use:

                   Not IsEmpty ( FilterValues(Profession;Export fields for visitors::Visitors Profession ) )

                   This may or may not have any effect on how your script performs.

                   With regards to global storage, do this test. Go to a layout and enter find mode. Note how all fields are now empty unless you enter find criteria into them. The sole exception will be any fields that have global storage specified in field options. They will continue to display their contents but you cannot enter them in find mode as you can't specify find criteria in a global field.

                   In your script, you have two If steps. The first is:

                   If [ Not IsEmpty ( Export Fields for visitors::Visitors Profession ) ]

                   Unless you specify global storage for Visitors Profession, the expression inside the [ ] will always evaluate as False in Find mode because this field will always be empty in find mode. Thus, you need to either change the storage options for this field to make it global or you need to copy the value into a variable before you enter find mode and then use the variable in this step instead of the original field.

              • 4. Re: Inconsistent Find Results
                Kaps_1

                     I double checked and Visitors profession is a global field. (see attached screen shot) and I have changed the definition of the visitors search field to :-

                     not IsEmpty ( FilterValues(Profession;Export fields for visitors::Visitors Profession ) )

                     and I still get an empty found set.

                      

                • 5. Re: Inconsistent Find Results
                  philmodjunk

                       I took a closer look at your script and found another issue:

                       ">=" & Export fields for visitors::Earliest Date of Visit and "<=" & Export....

                       is not valid find criteria., You can't use the and operator like this in find criteria as it will be evaluated as part of the set field that assigns the criteria to your field not as part of the find.

                       Use this expression instead:

                       Export fields for visitors::Earliest Date of Visit & "..." & Export fields for visitors::Latest date of Visit

                  • 6. Re: Inconsistent Find Results
                    Kaps_1

                         Thanks !!!