6 Replies Latest reply on Mar 9, 2016 1:41 PM by bigtom

    Create Line Items with Popover

    AndrewJudd

      Hi all,

       

      I have a script - attached below - that creates line items records for portals using a popover.

       

      This one does my price lists.

       

      I have a line items table occurrence called ADD NEW that is "allowed to create records by the relationship".

       

      My question - is there a better (faster / cleaner) way to create line items records using a popover?

       

      I have noticed with a database that is hosted over a server you have to wait a moment for it all to work (not ages) but it would be great if it could (if possible) be sped up somewhere.

       

      Be great to hear any thoughts.

       

      Thanks!

       

      Screen Shot 2016-03-08 at 22.53.18.png

       

       

       

      Screen Shot 2016-03-08 at 22.57.48.png

        • 1. Re: Create Line Items with Popover
          fitch

          "Using a popover" isn't a lot of information to go on. There are all kinds of things that can cause performance issues.

           

          One think I noticed is that you have "Allow create" checked on both sides of the relationship. That's kind of unusual, unless it's a join table. Based on your relationship name, I imagine you only want to add new records to the "NEW" side, so I'd uncheck the "PRICE LIST" side.

          • 2. Re: Create Line Items with Popover
            bigtom

            So you are entering records into a table that is then needing to automatically create a record in another table?

             

            If the connection to your server is not so good and things can take time, but in most cases you should not notice. How are you confirming the speed is slow? Have you tried Refresh Portal or Refresh Window script step to get the latest data. That often helps especially over WAN with data separation.

            • 3. Re: Create Line Items with Popover
              AndrewJudd

              thanks.. the popover has a portal inside that shows records in my artwork table. There is a script button on a calculation description field of each artwork. There is also a thumbnail image in the portal of each work.

               

              How does the refresh work? / help? does that happen before or after the script above? or both?

               

              I'm entering records into a line items table of artwork - its done in the above way so the layout doesn't have to change (and therefore the popover doesn't close). The portal on my price list then shows line items that are related.

               

              thanks all.

              • 4. Re: Create Line Items with Popover
                fitch

                The thumbnails could be slow. The calculated description field could be slow. Try removing one vs. the other and see how the speed compares.

                 

                If the related table has many fields, particularly text fields that contain large amounts of text, that could make it slow. You might break that into another table.

                 

                If the table has many records, there's potential for slowness, especially if your relationship or portal is sorted.

                 

                I guess I should ask which part is slow -- displaying the popover/portal, or the script that runs when you click the button? My comments here are more about the portal display. bigtom's suggestion would be about the script. Refresh Window gives you the ability to "flush cached join results" --  worth a try if related records aren't updating as quickly as expected.

                • 5. Re: Create Line Items with Popover
                  AndrewJudd

                  thanks, having run a few tests. the popup does load up slightly better using several text fields rather than a calculation so it may be better to change this.

                   

                  The slowness - which is not much but noticable - comes when you run the script. It seems to be because there are alot of records in the artwork table (1500). As I have another table for a different type of inventory and there are only 10 records in that and adding those to price list line items with a similar script set up is faster.

                   

                  window refresh does not seem to do too much.

                   

                  maybe this is just a filemaker thing and not something that can be quicker using a hosted database. my internet download speed is around 7 mb/s and upload is around 1 mb/s so not super quick i guess.

                  • 6. Re: Create Line Items with Popover
                    bigtom

                    Have you tried a layout with globals that then sends the new price data via PSOS to be run on FMS. This way you don't have to download all the data and process it on your device.

                     

                    1500 records is nothing unless they are full of large images and calculations. I think changing how you tables are structured will help.

                     

                    When you say it is taking a long time, how long is it really? 1-2 seconds, 5-10 seconds?

                     

                    I am assuming you have images of the art stored in the file. How large are those images and what table are they located in?