Tyra Posted October 9, 2007 Share Posted October 9, 2007 Is there a faster way of setting up the script below, It runs against about 2,500 records every 4 hours, and it takes a long time to go through. squatters.zip Link to comment Share on other sites More sharing options...
Ender Posted October 9, 2007 Share Posted October 9, 2007 Looping can be a slow process. If you only need to update a subset of records, try finding only those records first, then update only those. I can't say specifically how to do this in your file as it's missing the important structural bits. Also, the Go to Record Request [ Exit after last; Next ] should not be necessary after your Delete Record[]. This will cause the next record to be skipped. Link to comment Share on other sites More sharing options...
Ender Posted October 9, 2007 Share Posted October 9, 2007 And while looping can be slow, that alone wouldn't explain why this process would be slow for only 2500 records. You didn't say how "long a process" it is (5 seconds?, 30 seconds?, 5 minutes?). One other thing that can be a slow process is deleting records, especially if there are cascading deletes involved. If you don't need the cascading deletes, you might disable that in the relationship definition. Another option is instead of deleting the records, mark them as "inactive" or something, and filter them out of your relationships and Finds. This would effectively hide them from users and processes. You could then deleted them for real at some other time (or leave them in there). Link to comment Share on other sites More sharing options...
Tyra Posted October 9, 2007 Author Share Posted October 9, 2007 Ender, Than you for you help. I have added a step in the script to capture the start and end times to be able to provide a better time frame of how long it takes to run the script. I see your point about the next record step. But if I remove it, then it would compare the next record to the begining of the script would it? Would putting in a pervious record request work better? There is no cascading deletes, didn't know what that was until this morning, thanks to reading though this form. Link to comment Share on other sites More sharing options...
Ender Posted October 9, 2007 Share Posted October 9, 2007 I have added a step in the script to capture the start and end times to be able to provide a better time frame of how long it takes to run the script. So how long does it actually take? Link to comment Share on other sites More sharing options...
Fenton Posted October 9, 2007 Share Posted October 9, 2007 Another minor point, and I don't know if they've changed this in later versions of FileMaker (because I always do it -). A Loop will run much faster if the layout is in Form view at the time. For some reason List view will slow it down, because it thinks it has to update the scroll bar. Freeze Window also helps, but Form view was the key. What I do is View As [ Form ] before the loop, then View As [ List ] afterwards. Another thing to consider. Could more than one of these If tests be positive? If so then you're wasting time checking the others after it; they would be redundant. If more than one could match, then you should surround the later If tests with a test whether the field is already set to "squatter." It sounds like this is "more" testing, therefore slower. But it is many times faster for FileMaker to check a local field than it is to check related field. It is also slower when FileMaker has to set the same field more than once. And, if it could be more than one match, and one of them is more likely, it should be the 1st test. It also looked like to me that you never processed the 1st record, you immediately went to the Next (or Deleted then went to the next, which skipped). (P.S. Please test with sample data.) squatters_fej.fp7.zip Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6178 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now