2 Replies Latest reply on Nov 27, 2010 4:57 AM by AlanSawyer

    Creating new record using existing record as template works in FMP but not IWP



      Creating new record using existing record as template works in FMP but not IWP



      My table User is related to a table Sample through User_ID (unique for each User)

      Another instance of the table Sample (called Sample2) is related to User using User_ID so that I can see all of the samples that the user has in a self-join portal.

      I use a script to create a new record in Sample2 from the table User

      The script I have written first sets a variable $UserID to the User_ID in the table User then switches layout to the Layout showing records from Sample2, creates a new record, sets the field User_ID in Sample2 to the value of variable $UserID.

      This step works really nicely and I can see the name of the person appear in the new record so the relationship is built properly.

      I then use another script from a button in the portal (self-join and displaying the records from Sample) to set all the values in the current (new) record in Sample2 to those contained in the appropriate record from the table Sample so that my user can use the data they have already entered (from pre-existing samples in their sample library) as a template which they can then edit and submit (another button that commits the data and returns them to the User layout).

      This all works really nicely in Filemaker, but as soon as run these scripts through IWP all the steps work right up to the final one.

      If I have manually entered everything the record comes back blank

      If I have used a template by copying across and then editing the template to something new and clicking the submit button (which commits all the data and then returns to the User layout) when I examine the details of that sample it turns out that the edits I made were not saved and the fields are populated with the data from Sample before I edited them.

      As I said, this script works perfectly if doing it within Filemaker, but does NOT work through a browser.

      There are no web-publishing incompatible script steps (I chaecked this very thoroughly)

      It is not a permissions problem as I tried this through an all-access account with the same result.

      I've been trying to work out what is going wrong now for 5 days and it's driving me nuts. I am a very experienced FMP user (been doing these databases since FMP2) and can only conclude that this is something to do with the way that committing data is done in IWP and may well be a limitation of IWP.

      Can anyone help?



      FMP11 Advanced. Filemaker Server10 Advanced. Mac OS X 10.6.4

        • 1. Re: Creating new record using existing record as template works in FMP but not IWP

          I think we'd need to see the scripts you are using for this in order to suggest a solution. If you have regular FileMaker, you can print a script to a PDF and then use the PDF reader's text tool to select the text and copy it to the clipboard for pasting here in the forum. If you have FileMaker Advanced, you can generate a Database Design Report and copy/paste scripts from the report to the forum.

          • 2. Re: Creating new record using existing record as template works in FMP but not IWP

            Hi Phil,

            I nailed it down to the self-join relationship and its portal. When I create a record in FMP it immediately appears in the portal. Not so with IWP (of course). As soon as I got rid of the portal the whole thing works like a dream. It means that I can't use this method to populate the new record with data from the person's sample library (using the data like a template from an old record which can then be edited) so I will probably create a separate layout where I can populate a bunch of variables, then switch to the layout without a portal in it. So it's all sorted but this is definitely a limitation that IWP has when dealing with creating new records where there is a self join portal in the layout. I have exactly the same arrangement as this elsewhere in the database but because this is not a self-join portal it works fine over IWP.