Could you post both of the full sripts?
Check each instance of the variable $$NewEndDate in your script. If one of these is misspelled then you might have a situation where you think you typed in $$NewEndDate and really typed something else. That might cause the following expression:
$$NewDate >= $$NewEndDate
to evaluate as 4 >= /*no value */
which would cause your loop to exit.
In your post, you posted the exit Loop step as "Exit Loop If[$$NewDate >= NewEndDate" If that's how it looks in your script then NewEndDate is not the same thing as $$NewEndDate and that might explain things.
I would, but each script is 50+ steps.. As far as I know there is no way to copy a script to a text format? If there is let me know.
Is there something that you would be looking for that I can look for?
I caught that too, but I think it was a typo. Otherwise, one would get an error as it wouldnt represent a field or variable.
Print to PDF and then copy paste.
Since you have FMP advanced, you can generate a database design report and copy the script from there.
Mr. Vodka, I agree on the "typo in original post", but it does suggest one explanation which is a mistyped (but still correct format) variable name.
$NewEndDate or $$NewEndDat
Would be two possible examples.
Ok, here is the paste of the code. I put them at pastebin to avoid the really long post.
AddNewVacation QCG(Contains the main loop) --- http://pastebin.com/m202ea82f
AddFromVacInfo QCG --- http://pastebin.com/m6d83f1bb
Thanks for all your help!!!
EDIT: Sorry for the poor formatting on pastebin. It handles most characters, but apparently not greater than/equal to.. Everywhere that is says ≥ should be >=
Some indenting would have made the code easier to read also. :smileywink:
A visual scan of your code didn't show anything obvious.
Your code suggests that you may have a less than optimum database design. If you were to modify your table structure to use a related table of days instead of dedicated fields within the same record, you could probably create a much simpler script and this simpler script would be easier to debug, analyze and maintain.
Sorry for the lack of indenting. Just copy and pasted it from the database design report. I'll put some indentation in there in a minute.
Here's a picture of really what's confusing me.
My debugger is showing me that $$NewDate = 4, $$NewEndDate = 31, and $$NewDate >= $$NewEndDate is True.
This same set of variables holds true before the exit loop step, during the exit loop step, and after the exit loop step.
I just can not find any logical reasoning for why I would be getting this error.
I think I've got it. Is it possible that the field you are using to assign a value to $$NewEndDate is a text field?
Using a text based comparison, "4" >= "31" is true.
Try enclosing the field in a getasNumber function:
GetAsNumber( Office Files QCG::NewVac EndDate )
I'm home from work at this point, and won't be able to access the database to verify if that field is text or number. It should be number, but I may have accidentaly (stupidly) made it as text. That seems to be the best solution that I can develop, being that the only other solution I have is FileMaker is broken :P
Just a quick question.. Does FileMaker use ascii values to compare textual values to numerical values? Doesn't change the correctness of this solution; I'd just like to know for further reference.
UPDATE : It worked! Silly me, I was moving too quick and made that field a text, instead of a number! Script runs fine. Thanks everyone so much for your help!