We need to know more before we can replicate the issue.
Please post your script so we can see exactly what it does.
To post a script to the forum:
- You can upload a screen shot of your script
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF.
- If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional look to your script. (Use the HTML option and paste the text into the HTML editor.)
Please note that when the IF expression evaluates as True, the Else IF will be skipped no matter what it evaluates to. That's by design. (Apologies for pointing out the obvious, but we have to rule out the obvious in issues like this before we can dig deeper.)
Phil, I think you've nailed it. Sounds like a misunderstanding of the the If/Else If/End If construct is supposed to accomplish. If/Else If checks for the first true evaluation, then skips all else. That's just how it works.
We'll need to hear from the OP to be sure. If that's the case, this alternative structure might work:
If [test 1 here]
Code for test 1
Else If [Test 2 here]
code for test 2
If [Test 1 here ]
code for test 1
If [Test 2 here ]
code for test 2
PhilModJunk> your suggestion works, but as mentioned in my original post that was also the workaround I suggested (although not very well explained)
The issue is that it simply ignores any "true" tests under the "else if" part, even though no previous part of the if structure was deemed true)
The problem is quite strange.
And now I found the error... You are absolutely right.
It deemed the first condition as true, because I put in an '&' instead of an 'and', which made the evaluation = 1 between two conditions in the very first IF statement where the first was false, but the second was true.
As that IF statement had no underlying steps defined yet, I did not notice that it was in fact being performed.
You can chalk this up to an Error 40 (Error caused by individual 40 cm from the screen)... dammit..
This will teach me to put something/anything under an IF part to determine if it gets run.
Thanks for your help :)
And the reason it worked fine regarding the portal was that the condition in the first part was linked to the portal... when empty, both tests were 0...
IF: $scrparam="reply" & SMSdatabase relation for test only::SenderNumber ≠ $smsservice and IsEmpty(SMSdatabase relation for test only::SenderNumber)=False
<no steps defined>
ELSE IF: $scrparam="new"
The & was the mistake... it should have been an 'and'. Because the first IF did not have steps defined, I focused on the ELSE IF and could not understand why it did not evaluate it. It was such a simple test and it was true... Stupid stupid...