6 Replies Latest reply on Sep 22, 2014 8:29 AM by philmodjunk

    Need Help with Calculation

    SydneyBlock_1

      Title

      Need Help with Calculation

      Post

      I think I need some specific coding help. I created a button to send an email to specific addresses depending on the selection in a field’s drop down list and I am having trouble getting it to function correctly. (We have not received FileMaker Pro Advanced yet) The script has an error right after the “Commit Records/Requests” and it says “The operation could not be completed because the target is not part of a related table.” Not sure what this means or what the target is. The script is pictured below.

      In the Send Mail script step, I have a calculation to ask to email specific people depending on the selection in a field. It looks something like this:

      If(Observations::Jobsite = "90165 - Oneok MB1";
      "dmatherne@tellepsen.com; cramer@tellepsen.com";
      "")
      &
      If(Observations::Jobsite = "90155 - Oneok MB2";
      "dmatherne@tellepsen.com; cramer@tellepsen.com";
      "")

       

      Now, I understand I could nest the If functions, but there's at least 30 of them.

      How do I find out what the "target" is to make sure it's part of a related table?

       

      Script.jpg

        • 1. Re: Need Help with Calculation
          philmodjunk

          This error message typically shows up if a set field step attempts to modify a field via a reference to a table occurrence that is not related to the current layout's table occurrence. None of the calculations in your script would produce such an error. If the context is not correct, such calculations would simply fail to return a value.

          Once you have advanced, you can use the script debugger to more easily look for the culprit. But I suspect that commit records is tripping a script trigger and a different script is interrupting this one with a set field step that produces the error you are seeing here.

          • 2. Re: Need Help with Calculation
            SydneyBlock_1

            Thank you so much! What I tried to do was clear the Commit Records script step to see if that would help and unfortunately it didn't. My 3 tables for this particular layout are

            - Person Injured (xP_EmpID = serial number)

            - Injury Information (xH_EmpID = number field directly related to xP_EmpID)

            - Treatment Information (xE_EmpID = number field directly related to xP_EmpID)

            I have the layout set up with a slide control and each one has solely one specific table's fields on it. The layout is based on the Person Injured table occurrence.

             

            • 3. Re: Need Help with Calculation
              philmodjunk

              Which does not change the fact that no part of your script shown attempts to modify data and thus there is no "target" reference that can be from an unrelated table occurrence. So I still think that some other script is the actual source of this error message.

              • 4. Re: Need Help with Calculation
                SydneyBlock_1

                 Would the script debugger in Advanced show which other script is trying to run?

                • 5. Re: Need Help with Calculation
                  SydneyBlock_1

                  I figured it out, thank you SO much for all your help. I have a VERY similar field in an unrelated table that I created that calculation for and instead of changing it to the right field when I chose to use essentially the same code in a different table, I left it as the field from the unrelated one. I changed the field and it works perfectly now :)

                  • 6. Re: Need Help with Calculation
                    philmodjunk

                    Yes, the debugger will catch "triggered script interference". As you step through a script in the debugger, if it trips such a trigger, the trigger performed script will automatically pop up in the debugger.