13 Replies Latest reply on May 11, 2010 5:08 PM by mattb

    Speed question

    mattb

      Title

      Speed question

      Post

      I have a screen which has a 200-record portal with a dropdown above it.  When the user selects a choice from the dropdown, it

      triggers a script which stuffs one field in the table (the one showing in the portal) from the values of another field in the same table.

      I'm using a Loop-End Loop statement which iterates 200 times that contains a Set Field command within it.  To stuff data into 200

      fields and have them display in the portal takes about 4 seconds.  This seems kind of slow to me for the amount of data being handled. 

      I tried substituting a Replace Field Contents script step for the Set Field and it took twice as long! 

       

      I'm creating an OSX version (using FMP 11) of a commercial program written in Visual Foxpro for Windows.  In the Windows version,

      I'm stuffing variable arrays for the same screen and the stuffing and displaying is nearly instantaneous.  But since FMP doesn't have arrays

      per se, I seem to be stuck with the arrangement described above.  I tried forcing an index on the fields in question, but that doesn't seem

      to make any difference.

       

      Any tips on how to speed this up?  Thanks...

       

       

       

      Matt Bloomfield

        • 1. Re: Speed question
          littledog

          Hi,

          Looping with calculations via records is slow and Replace (practically the same) is slow.

          For 200 portal rows (not good idea, I think) probably the best is to look on file ideology again.

          Copying idea from another program always isn't a good idea except layout view, buttons and overall working with.

          What about Lookup, relationship conditions etc.?

           

          Probably I don't clearly understand your question.

          • 2. Re: Speed question
            philmodjunk

            Were you using a separate layout based on the portal's table and looping through the records using go to record [next] or were you looping through the portal rows using go to portal row [next]?

            • 3. Re: Speed question
              mattb

               


              PhilModJunk wrote:

              Were you using a separate layout based on the portal's table and looping through the records using go to record [next] or were you looping through the portal rows using go to portal row [next]?


              I'm using go to record[next].  Would using go to portal row[next] be faster?

               


              • 4. Re: Speed question
                philmodjunk

                I don't really know. Given the added "overhead" of interacting with the portal, I'd expect it to be slower.

                • 5. Re: Speed question
                  aammondd

                  How is it getting the data to stuff from this table.

                   

                   

                  • 6. Re: Speed question
                    philmodjunk

                    I just did a couple of  tests

                     

                    I used a simple 200 record found set with two fields in my table, both are number fields.

                    Neither a looping script nor replace field contents took even 2 seconds to set a number field to a constant value such as 2. The replace field contents script was definitely faster.

                     

                    Does your table have a number of stored calculation fields that refer to the field you are changing? If so, the time needed for each of these fields to re-evaluate could be part of the delay.

                    • 7. Re: Speed question
                      mattb

                       


                       

                      Does your table have a number of stored calculation fields that refer to the field you are changing? If so, the time needed for each of these fields to re-evaluate could be part of the delay.


                      No, it doesn't.  I'm just running a loop for each record in the table (200 records).  It's stuffing a field (the one on the portal) with a value from another field in the same table.  I'm using the Set Field command inside the loop.  Unlike your experiment, the field I'm dealing with here is a text field, which could contain as much as a short paragraph, maybe 100 characters max...

                       

                      • 8. Re: Speed question
                        comment_1

                         


                        mattb wrote:

                        It's stuffing a field (the one on the portal) with a value from another field in the same table.


                        What for?

                         


                        • 9. Re: Speed question
                          mattb

                           


                          comment wrote:

                           


                          mattb wrote:

                          It's stuffing a field (the one on the portal) with a value from another field in the same table.


                          What for?

                           


                           

                          Welll...I'm tryiing to duplicate functionality from an existing screen which is from an existing commercial Windows app that I wrote in Visual Foxpro.

                          This particular screen contains 6 columns, each column contains 200 records.  The contents of each column, however, is selected by the user from a dropdown above the column.  The data that fills these user-selected columns is already existing in the same table...

                           

                          Does this help?



                          • 10. Re: Speed question
                            comment_1

                            I don't think this is a good approach. For one thing, when a user selects a value from one of the drop-downs, the replace is going to affect ALL users - regardless of THEIR chosen value for the same column.

                             

                            You should try to accomplish the filtering by relationships and calculations alone.

                             

                            I would also suspect that the speed issues here are caused by the amount of layout objects to render. You can test this by trying the replace in an empty layout, in form view.

                            • 11. Re: Speed question
                              mattb

                               


                              comment wrote:

                              I don't think this is a good approach. For one thing, when a user selects a value from one of the drop-downs, the replace is going to affect ALL users - regardless of THEIR chosen value for the same column.

                              -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                               

                              Not an issue - this is a standalone program operated by single user not using a network...

                               

                              -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                               

                              You should try to accomplish the filtering by relationships and calculations alone.

                               

                              -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                               

                              I'm not really filtering so much as re-displaying data (based on a user choice) in 6 columns.  

                               

                              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

                               

                              I would also suspect that the speed issues here are caused by the amount of layout objects to render. You can test this by trying the replace in an empty layout, in form view.

                               

                              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                               

                              You may have somewhat of a point here.  I just tried a test by duplicating the layout and removing 5 columns, leaving just one.  The data

                              stuffing routine now takes approximately 2 1/2 seconds instead of 4, still too slow, but a noticeable difference.

                               


                               


                              • 12. Re: Speed question
                                comment_1

                                I'd still suggest you reconsider the basic structure. If you're modeling your engine after Foxpro, it will take advantage of the strengths of Foxpro - which are not necessarily the strengths of Filemaker.

                                 

                                BTW, I don't know a person who could take in 1,200 data items at once (unless they happen to be points on a graph or something).

                                • 13. Re: Speed question
                                  mattb

                                   


                                  comment wrote:

                                   

                                  You should try to accomplish the filtering by relationships and calculations alone.

                                  -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                                   

                                  OK, problem solved - I redefined the field in the portal from Text to Calculation and put in a Case statement which evaluates the user's dropdown

                                  choice which would then fill the column with the appropriately related field contents.  And it fills in instantaneously now, as well. 

                                   

                                  After a while, my Visual Foxpro way of thinking will transition into an FMP way of thinking. Right now my experience level is 20 years on Visual Foxpro and 6 months on FMP.  Thanks!