5 Replies Latest reply on Jan 6, 2016 11:42 AM by DanielShanahan

    Strange result in Constrain Found Set

    kashaev

      I have a project database related to equipment items by the project number.  From within a project (where I'm viewing the equipment Items) I have a print function allowing the user to select with a radio button "Y" or "N" to include the equipment items in the report.  It has been working for literally years without an issue until yesterday.  When going to the items list layout to select the "Y" or "N" everything seems to function fine. my reset scripts work without a problem to turn all items either "N" or "Y".  You can make your selections and continue to print the report and the report prints fine...all of the items you have selected print.  The issue is that it also prints one extra item from the project...which item seems random from project to project...but is always the SAME item from that project.  It is not as easy as the first or last item from the project, and it does not happen on every project. 

       

      I'm using a script with the "Constrain" function and the criteria for the constrain is if the equipment has a "Y" in the printing field. (see attached screen shot)

       

      Any thoughts?

      Screen Shot 2016-01-06 at 9.57.22 AM.png

        • 1. Re: Strange result in Constrain Found Set
          DanielShanahan

          kashaev wrote:

           

          The issue is that it also prints one extra item from the project...which item seems random from project to project...but is always the SAME item from that project.  It is not as easy as the first or last item from the project, and it does not happen on every project. 

          Can you provide screenshots from three different projects that have an extra item?

           

          It has been working for literally years without an issue until yesterday.

          What changed yesterday?  New data?  New data entry person? New operating system?  New computer?  New version of FMP?

          • 2. Re: Strange result in Constrain Found Set
            kashaev

            What changed yesterday?  New data?  New data entry person? New operating system?  New computer?  New version of FMP?

            Nothing that I can pinpoint. The database is accessed across our network.  The computer running the database has not been updated or changed in more than a year and the two of us using the database on our laptops have not done any updates recently. 

             

            Here are some shots from two:

             

            In the project below, no matter which items you select item 6042 always prints

            Screen Shot 2016-01-06 at 11.34.50 AM.png

            Shot above is the selection screen. Below is the print result.

            Screen Shot 2016-01-06 at 11.35.09 AM.png

            In the project below, no matter which items you select item 23 always prints

             

            Screen Shot 2016-01-06 at 11.42.19 AM.png

            Shot above is the selection screen. Below is the print result.

            Screen Shot 2016-01-06 at 11.42.04 AM.png

            • 3. Re: Strange result in Constrain Found Set
              DanielShanahan

              Thanks.  That is helpful.

               

              Can you add a few more screenshots?

               

              1. Duplicate the layout "Select Items to Be Printed"

              2. Make the list row larger.  Large enough for a record to display at least two lines. (you'll see why below).

              3. Duplicate the field for Yes/No.

              4. Make that field and Edit box instead of a Radio Button and adjust the Height to display two rows.

               

              You may have to move some of the fields to make room.  That's why it is best to do this on a duplicate record.

               

              The second screenshot I'd like to see is the script itself.  Your original post shows the constrain portion of the script but I think it would be helpful to see the whole thing in context.

              • 4. Re: Strange result in Constrain Found Set
                kashaev

                Okay,  Here is a shot of the duplicated layout with the Y/N field in the original radio button config and the edit box next to it.

                The second is the print result and the third is the script used to accomplish this.

                 

                Screen Shot 2016-01-06 at 2.19.39 PM.pngScreen Shot 2016-01-06 at 2.20.22 PM.pngScreen Shot 2016-01-06 at 2.21.22 PM.png

                • 5. Re: Strange result in Constrain Found Set
                  DanielShanahan

                  Ok, so it looks like the data entry is correct, so that eliminates that as a problem.

                   

                  In your script, when you Go to Related Record, do you get the correct found set?  If you have FileMaker Pro Advanced then you can step through the script with the debugger.  Otherwise, you can temporarily add an Exit Script script step after Go to Related Record.

                   

                  Also, a suggestion:

                  Write out the Constrain Found Set script step.  Using the Specify Find Request dialog box makes it hard for debugging.  Instead, clear out the Specify Find Request that you have and replace with the following:

                   

                  Enter Find Mode [ ]

                  Set Field [ ProjectItems::SpecP ;  "Y" ]

                  Constrain Found Set [ ]

                   

                  I'd also add a condition in the event that there are no found records:

                   

                  If [ Get ( FoundCount = 0 ) ]

                    Do Something

                  End If