Racer Bob Posted January 13, 2008 Posted January 13, 2008 I have encountered what seems to be an inexplainable failure of the IF statement. Case I have a script I want to have act differently depending on which Layout is displayed. However, the IF Get(LayoutName)= "xxx" refused to evaluate. I know the Layout name is valid as that is how it got displayed. But the IF statement will not evaluate as true even though the Date Viewer shows the correct value for the Get(layoutName). I can make it work by which window is displayed, but not by the Layout displayed. This seems to be a little strange. I have tried deleting the statement and then adding it again after making sure the script runs ok otherwise but no luck. Anyone else experienced this little "Quirk" Bob
comment Posted January 13, 2008 Posted January 13, 2008 It's hard to say without seeing the file or at least the script. I'd suggest to put a pause in the script just before the If[] step (or use the script debugger) and see what Data Viewer returns at that moment.
Racer Bob Posted January 13, 2008 Author Posted January 13, 2008 Let me make it clearer. Running Debug and the Data Viewer clearly show the correct name of the layout is being obtained by the Get(layoutName) function. But the simple IF statement won't act on it. The step is IF (Get(Layoutname)="Parts Invoice Layout" The Data Viewer returns Get(Layoutname)="Parts Invoice Layout" Yet the IF statement skips the following script step and goes to the Else condition. I have run into things that refuse to work before with FileMaker and usually requires deleting the entire problem issue and re-constructing it then they work. No changes, just re-entered the same construction. It seems sometimes FileMaker gets it "mind messed up" internally and refuses to function correctly. But this time, no amount of redoing the script steps will get it to trigger off the Layout Name.
comment Posted January 13, 2008 Posted January 13, 2008 I have run into things that refuse to work before with FileMaker and usually requires deleting the entire problem issue and re-constructing it then they work. No changes, just re-entered the same construction. It seems sometimes FileMaker gets it "mind messed up" internally and refuses to function correctly. I haven't encountered such behavior, except perhaps with corrupted files. Can you strip your file to the minimum required to demonstrate the problem and post it?
LaRetta Posted January 13, 2008 Posted January 13, 2008 Hi Bob, 99.99% percent of the time, it is something which, if you would not delete and redo but continue to dig into, you would have eventually found (and added to your bag of tricks to always watch out for in future). It is usually the simple things. But yes, I can replicate your problem. Run it through data viewer as well. Might it have happened because of something like this? It certainly has for me!! LaRetta Simple_Things.zip
Racer Bob Posted January 13, 2008 Author Posted January 13, 2008 Thanks for the replies. What I have found out is that it had to do with that specific layout Name. THE ANSWER When naming the Layout, a blank space was attached to the end of the name. Of course this isn't apparent in the Layout Setup form. This came about because the new layout started as a duplicate of an existing layout. While changing the name, the space ended up at the end. Padding clearly is possible with Layout names. While this didn't cause a problem with the script step to display the layout, the IF statement was another matter. It took into account the extra blank space on the end of the name and then considered it a non match if the "match to" value didn't also have a blank space on the end.
LaRetta Posted January 13, 2008 Posted January 13, 2008 Did you check the file I attached? That's exactly what it showed you. :smirk:
Racer Bob Posted January 13, 2008 Author Posted January 13, 2008 Sorry, since you didn't say anything about an extra space padded onto the end of the layout name I had to figure it out myself. It only shows up when clicking on the layout name in the layout setup box. Then the whole name is highlighted and it is possible to realize there is extra space on the end of the layout name. Clearly the IF statement is much more "literal" than the Go To Layout step. That is what was confusing, being able to call up the layout by the padded name but not process it in the IF statement. All works out in the end. Thanks for the reply
comment Posted January 13, 2008 Posted January 13, 2008 Clearly the IF statement is much more "literal" than the Go To Layout step. I don't think so. You were able to call up the layout by the padded name, because that was its true name. Had you tried going to the layout by the same name minus the trailing space, it wouldn't work.
Racer Bob Posted January 13, 2008 Author Posted January 13, 2008 Your right. Because the normal way to specify the Layout name in the script step is to choose from a list, it is automatic. If one usee the calculation method and hand entered the layout name without the padded end space, it won't go to the layout.
Recommended Posts
This topic is 6160 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