AnsweredAssumed Answered

"Else if" script condition being ignored even if true

Question asked by lordhellfire on Nov 7, 2011
Latest reply on Nov 8, 2011 by lordhellfire


"Else if" script condition being ignored even if true


FileMaker Pro


11 Advanced

Operating system version

Server 2008 R2

Description of the issue

A script which runs with IF and ELSE IF steps sometimes ignore the true condition of an ELSE IF.

The DataViewer tells me that the condition is 1 or TRUE when the script reaches the step, but it just continues to the next ELSE IF step to check if that is true, instead of performing the script steps within the ELSE IF statement.

Hope you can recreate the problem and fix it :)

Steps to reproduce the problem

My entire setup is fairly complicated, but the basic part is this:

I have a layout with a portal to a related table.
The layout stores projects and the portal/related table stores SMS-messages.
When the portal is empty, the script runs fine.
When the portal contains sms-messages, the script fails to acknoledge the ELSE IF step even if it is true.

The condition is VERY simple and doesn't even refer to anything inside the portal, it only checks the script parameter. It only checks if the script parameter says NEW. The button which activates the script does indeed have NEW as the script parameter.

The IF sentence on the first IF does however refer to data in the portal and another related database. but I tried retrieving the data into $variables and testing against those. The DataViewer confirmed that the data was indeed retrieved correctly.

Expected result

I expected it to go into the ELSE IF sentence when the condition was true.

Actual result

It just skipped the ELSE IF sentence even if true.


If I rewrite the script to be only IF sentences, it works fine all the time.
- ie. change all "ELSE IF" to a "END IF" and a new IF sentence.

This kind of defeats the purpose of having an "else if" sentence...