5 Replies Latest reply on Feb 28, 2011 3:37 PM by zinny

    insert calculation won't work properly

    zinny

      Title

      insert calculation won't work properly

      Post

      Hi,

      I am attempting create a list to use in an email. I want to gather information from a series of records (the name of person and status say), dump that information into a global field and then use that global field in the email script.

      I have done this sucessfully before using a loop command and then inserting calculated result into global field (with the select entire contents button off).

      In fact my first script works fine, it grabs the 5 related records and makes a list in the global field that I can use later.

      But my second script, copied off the first replaces the contents of the global field with each new record's information rather than adding to it.

      The second script uses a different related table and has some minor tweaks before the actual loop takes place but does not in any essence do anything different (and yes, the 'select entire contents button is off)

      The funny thing is when I take the go to next record (exit on last) line out of the script and run it the script adds continual copies of the one record. 

      It seems like the go to next record command is affecting the select entire contents.

      Has this happened to anyone else? Is there another secret button? I have tried dumping the info into the other scripts Global field but it does the same thing so I can only conclude it is something in the script. I have also shut down filemaker and that has not worked either.

      Any help will be appreciated, thanks

        • 1. Re: insert calculation won't work properly
          philmodjunk

          No way to answer that without seeing the actual script.

          You can post a copy of your script without having to type it line by line:

          1. You can upload a screen shot by clicking the edit link to your original message and uploading it there
          2. You can upload a screen shot to a file share site and post the download link to a new response you post here.
          3. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF.
          4. If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
          • 2. Re: insert calculation won't work properly
            zinny

            Thanks for that, this is the script from the database design report

            Script Name - get camera episode credits   Run script with full access privilegesOff   Include In MenuYes   Layouts that use this script     Scripts that use this script

            Script Definition   Script Steps

            • Go to Related Record [ From table: “Camera Credits Link”; Using layout: “Crew credits link” (Camera Credits Link) ] [ Show only related records; New window ]
            • Set Field [ Camera Credits Link::crew credits gb; "" ]
            • Go to Record/Request/Page [ First ]
            • Loop
            • Insert Calculated Result [ Camera Credits Link::crew credits gb; Camera Credits Link::Full Name ]
            • Go to Record/Request/Page [ Next; Exit after last ]
            • End Loop

            Fields used in this script

            • Camera Credits Link::crew credits gb
            • Camera Credits Link::Full Name

            Scripts used in this script     Layouts used in this script

            • Crew credits link

            Tables used in this script     Table occurrences used by this script     Custom Functions used by this script     Custom menu set used by this script

            Hopefully that is helpful

            • 3. Re: insert calculation won't work properly
              zinny

              This is the script that works

              Script Name - get story names   Run script with full access privilegesOff   Include In MenuYes   Layouts that use this script     Scripts that use this script

              Script Definition   Script Steps

              • Go to Related Record [ From table: “Story credits link”; Using layout: “storycreditlist” (Story credits link) ] [ Show only related records ]
              • Set Field [ Story credits link::Credit info; "" ]
              • Constrain Found Set [ Specified Find Requests: Omit Records; Criteria: Story credits link::_STORY TITLE: “==additional” ] [ Restore ]
              • Sort Records [ Specified Sort Order: Story credits link::RATING; based on value list: “Story Rating” ] [ Restore; No dialog ]
              • Go to Record/Request/Page [ First ]
              • Loop
              • Insert Calculated Result [ Story credits link::Credit info; Story credits link::_STORY TITLE & ¶ ]
              • Go to Record/Request/Page [ Next; Exit after last ]
              • End Loop
              • Go to Layout [ original layout ]

              Fields used in this script

              • Story credits link::Credit info
              • Story credits link::_STORY TITLE
              • Story credits link::RATING

              Scripts used in this script     Layouts used in this script

              • storycreditlist

              Tables used in this script     Table occurrences used by this script     Custom Functions used by this script     Custom menu set used by this script

              • 4. Re: insert calculation won't work properly
                philmodjunk

                Can't see any obvious errors here, other than that the first script's insert seems to be missing & ¶ to break the entries up into a return separated list.

                Insert steps require that the target field be present on the current layout in order to work--so I avoid them if there's an alternate approach possible. I don't see how that would match what you are describing here as if the field is missing, I'd expect to see an empty field instead of the last item of the list.

                I'd use this step to build such a list:

                Set Field [ Camera Credits Link::crew credits gb; List ( Camera Credits Link::crew credits gb ; Camera Credits Link::Full Name ) ]

                Since you have advanced, have you tried running this script with the debugger and data viewer enabled? That might help you spot where, how this script is failing.

                • 5. Re: insert calculation won't work properly
                  zinny

                  Thanks heaps for that,

                  There is always a simple, elegant script step that makes it all work better that I don't know about. Now I should go back and rewrite my old scripts.