AnsweredAssumed Answered

Possible bug with Get Next Record

Question asked by MaineSteve on Aug 31, 2009
Latest reply on Aug 31, 2009 by MaineSteve


Possible bug with Get Next Record

Description of the issue

I have a very frustrating problem here and I've tried to isolate it to see if I have a script problem.  But nothing appears to be wrong with the script, so I'm submitting the problem here for consideration. I currently have 10.0v3 and am trying to have a script go to the Next or Previous record using Record/Request/Page.  I have two buttons and they both call the same script.  Clicking on Button 1 sets a script Parameter to "NextButton", clicking on Button 2 passes a script Parameter of "PrevButton".  The Parameter is put into a variable called $NavParameter, then a script is called in another file which uses an If evaluation to determine if Record/Request/Page Next or Record/Request/Page Previous should be used. For the most part the scripts work fine.  As expected clicking on Button 1 indexes the current record in the other file to the next record, clicking on Button 2 goes to the previous record.  But then something happens and when clicking on Button 1 (Next) it bounces back one record previous.  Clicking on Button 1 (Next) indexes it to the next record again, but another click on Button 1 puts it back one.  It's stuck in a loop like that no matter how many times I click on the button.  I have used Button 2 (Previous) to go from the end of the file to the beginning without problems.  Random placement anywhere within the file also works flawlessly for Previous.  It's only Next that has this problem and it has it in the same places every single time, so at least the "loops" are 100% predictable even if I don't understand why its happening. OK, here's what I've done to isolate the problem: 1.  I went to the secondary file and manually ran the script from there, which cut out the button clicking and variable setting.  I got the same loop behavior. 2.  I switched from using a variable to using a field with the same value, just in case something was getting messed up with the variable.  I got the same loop behavior. 3.  I moved the Goto Record/Request/Page Next step out of the variable evaluation and had it sit at the very top of my script with an Exit Script step just below it.  In other words, I have a script with one standard script step, no other stuff at all.  Running this script does index to the next record without any loop problems. 4.  Moving the Goto Record/Request/Page Next step back into the If evaluation brings back the same behavior again. The only thing I can conclude is that there's a bug here.  After stripping out everything there are two cases, both of which should work identically but one doesn't: CASE 1 If Variable = "Next" then Goto Next Record   ELSEGoto Previous Record CASE 2 Goto Next Record It really is that simple a problem that I'm having. Case 1 just says "check this variable and do either A or B based on the result".  Extremely basic, simple stuff.  Case 2 just skips the evaluation, but uses the same exact script step to move to the next record.  And yet one works consistently wrong, the other works consistently correct.  And Previous works 100% either way. The worst thing about this is there *is* a common factor as to where the "loops" are encountered.  But it makes absolutely no sense! I have an ID field which contains unique ID numbers.  The loops seem to be right before there is a gap in the ID numbers (from deleted records). If I skip over this by manually indexing to a run of consecutive IDs I don't have a problem again until it hits a gap in the IDs. Yet this field is not being used in any way shape or form, so how can these loops be consistently prior to hitting a gap in a user created field?  The ID numbers are assigned by Filemaker (serial numbers), but still... there shouldn't be any correlation between these things and yet there is. Anyway... I've wasted enough time on this problem for one day.  Hopefully there is something I can do to get around this problem.  Any ideas of what to try will be dutifully put to the test. Thanks, Steve