13 Replies Latest reply on Oct 20, 2014 11:49 AM by Mike_Mitchell

    Weird InsertFromURL Problem

    briancrockett

      My partner and I have been puzzling this for about a week now. I doubt if anyone will have an answer but at this point I'm a little desperate for new ideas.

       

      Some Background

      We have emails that go out from FM at night. Some of these reference our Web server and ask clients to download a file specific to the session they attended. We were getting complaints that sometimes the file is not on the web page as indicated in the email. So I was asked to verify if the file was there and change the text to not reference the file if it's not there. I asked our web guys for help and they provided me a URL where I could pass the session number and get a return of true or false if the session file was there or not. DEAD SIMPLE! I use InsertFromURL to set a field using the value returned from the URL and it works great during testing. I then use the value in the field as part of a calc to substitute the correct text for the email.

       

      The problem:

      Doesn't work during the nightly routines and clients ended up getting the wrong email text. The web guys went through their logs and there were no hits on their server during the night just the ones from testing during the day. I added another script step to capture the error message It returned 102 (Field Missing).

      1. Asked the network guys, there are no time restrictions on the firewall or routers that would block the IP.
      2. The context is correct for setting the field using InsertFromURLto as there are SetField statements to the same table before and after the InsertFromURL step and they are working. Including the field I used to capture the error.
      3. We wondered if the problem was the speed of the loop was too fast for the web page to respond so we added a .5 second delay after the InsertFromURL step. No go.

       

      Any ideas of where else to look would be appreciated.

        • 1. Re: Weird InsertFromURL Problem
          Mike_Mitchell

          Field Missing means the Set Field step can't address the field you specified. That means:

           

          1) It's not accessible from the current context

          2) It's in a file FileMaker can't find (which is a variant of #1)

           

          I would suggest that you double-check to make sure your context is correct. If you're firing this off as a server-side script, also check to make sure that there are no server-incompatible script steps. Finally, is this dependent on another file you have that the server-side script doesn't? Or perhaps that the account used for the server-side script doesn't have access to?

           

          These are all possibilities. If none of them pans out, check back and maybe post a copy of the script so we can take a look.

           

          Mike

          • 2. Re: Weird InsertFromURL Problem
            TimDietrich

            Brian --

             

            I know that you said that there are no firewall restrictions in place, but is it possible that the FMS server itself has a port restriction in place - something that would prevent it from reaching your Web server?

             

            Just a thought.

             

            -- Tim

            • 3. Re: Weird InsertFromURL Problem
              monkeybreadsoftware

              Insert From URL is limited in a lot of ways.

              Without a plugin it's hard to overcome this.

              • 4. Re: Weird InsertFromURL Problem
                thebridge

                and who might have such a plug-in, Christain?

                • 5. Re: Weird InsertFromURL Problem
                  briancrockett

                  Thanks for the replies.

                   

                  It's not the server. We run the routine from a client machine that uses Calendar and some shell scripts to launch FileMaker and start our nightly routines. We tested the script on the client machine and it works.

                  It's not the context as there are SetField script steps before and after the InsertFromURL step and they're going to the same table. Plus it works in testing.

                   

                  Maybe a plugin is the answer. Could someone suggest one?

                  • 6. Re: Weird InsertFromURL Problem
                    monkeybreadsoftware

                    CURL functions in MBS Plugin are one possible way...

                    • 7. Re: Weird InsertFromURL Problem
                      Mike_Mitchell

                      Just because they're going to the same table doesn't mean they necessarily are accessible. Are they in a related table? Is the relationship between them valid?

                       

                      A plugin isn't necessarily going to solve your problem here. It would only solve your problem if the results of the Insert From URL were invalid, or if it were timing out. I don't think that's what's happening, since the web server doesn't see a request.

                       

                      If your Set Field script is failing on a Field Missing error, that means either (a) the name of the field is invalid, or (b) the field is inaccessible at runtime. Figure out what's wrong there first. Put in additional steps to capture the values of your parameters in a log table. Capture the name of the layout, the name of the field, the primary key of the current record, the primary key of the target record, timestamps, whatever it takes.

                       

                      Something is different between the time you test and the time it runs in production. Dig a little harder and deeper. That would be my recommendation.

                      • 8. Re: Weird InsertFromURL Problem
                        briancrockett

                        Which specific function? There's like a hundred. It's just a simple URL. There are no parameters. The last item in the path is the session number.

                        • 9. Re: Weird InsertFromURL Problem
                          briancrockett

                          You're probably right. It's should be a field problem. Here's a snippet from the script. As you can see the 2 immediate steps before the InsertFromURL step are also writing to this table and they are working.

                           

                          Edit_Script__Import_Subscribers_Workshop_Summary_Every_Day___subscriptions_.png
                          I've already set a field with the error message and time stamp. I'll add more data to see what I can find.
                          I have a few plugins I can try as well. We have BaseElements and Troi TURL.
                          • 10. Re: Weird InsertFromURL Problem
                            DavidJondreau

                            Set Field[] isn't a great test, as Insert from URL[] requires the field itself to be on the layout, while Set Field[] does not. And the 102 error indicates the missing field is the problem.

                             

                             

                            Make sure "Select entire contents" is checked.

                             

                             

                            .5 sec might not be enough of a pause. You should probably check that the page has fully loaded.

                            • 11. Re: Weird InsertFromURL Problem
                              BruceHerbach

                              Are you running this as a server side scheduled script?  I have seen where it helps to put small delays in loops when doing things on the server like getting e-mail. 

                               

                              I have been setting up a log file that reports the error codes of all of the calls so I can see how this type of script does when being run on server.  The records are put into a seperate table.

                               

                              HTH

                              • 12. Re: Weird InsertFromURL Problem
                                briancrockett

                                WE HAVE A WINNER!!   A Trillion good karma points to David Jondreau!

                                 

                                We haven't used any of the "Insert" steps in so long (years & years) we forgot that they have to be on the layout.

                                We just use SetField for everything because it always works.

                                 

                                The layout I used for testing has all the fields so I can see what's happening. The one the script uses has a minimal set of fields, for speed and not the one being set by InsertFromURL.

                                 

                                I just tried the actual layout and got the 102 error. When I added the field being inserted to, it worked.

                                 

                                 

                                Thanks Again.

                                • 13. Re: Weird InsertFromURL Problem
                                  Mike_Mitchell

                                  Lesson: When you test, test under actual conditions:  

                                   

                                  Glad you got it working.