Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7777 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

For background, I've created a multi-page questionnaire with a script attached to a button on each page to determine whether the answers given are "correct" and therefore allow the user to continue. If any answer is wrong, then the questionnaire terminates itself. This has been working fine, except for a couple scripts that always evaluate the IF criterea as False, even when they are true. The result is that on those pages, regardless of the answers given, it will let you continue with the questionnaire, even if you shouldn't be allowed to continue. I'm stumped as to what's going on, since I have basically been duplicating these scripts and just changing the field names that I want the new script to check for True/False. I've copied two scripts below. The first one behaves correctly, but the second one doesn't. Ideas??

If ["OTCMeds_Okay = "No" or DietaryHerbal_Okay = "No" or PrescriptionMeds_Okay = "No""]

Go to Layout ["Intro Time Ending"]

Else

Go to Layout ["Health & Med Conditions"]

End If

---------------------------------

If ["Medical_Conditions_Okay = "No" or Psych_Conditions_Okay = "No""]

Go to Layout ["Intro Time Ending"]

Else

Go to Layout ["Alcohol, Seizure, Brain Injury"]

End If

---------------------------------

These are pretty straightforward scripts I think, so I'm having a hard time seeing where things are going wrong in the second one. All of the "_Okay" fields are Yes/No radio buttons defined by a value list, and I checked that they are in fact the correct fields on the respective layouts.

Thanks,

Peter

Posted

I made a demo of your scripts and there is nothing wrong with them that I can see. I noticed that if you have both Yes and No selected, it treats it as if the No was not checked

What are they NOT doing

HTH

Lee

confused.gif

Posted

Hi Peter,

You could try adding brackets to force the 'If' statement to evaluate in the order that you want:

If ["(Medical_Conditions_Okay = "No") or (Psych_Conditions_Okay = "No")"]

Regards,

Ernst.

Posted

If your field is defined as a number instead of text, I believe the If (text) will fail. And that's probably it. But if your data types are correct, you might also consider ...

You may have a space or other character in addition to the No. It may be both Yes & No values as Lee brought up. It could be causing your ="No" to not be

  • Newbies
Posted

Thanks for the replies so far. The plot thickens, though. Lee, as you observed, both of those scripts do behave correctly. However, if I add additional criterea to the If statement so it becomes

If ["Medical_Conditions_Okay = "No" or Psych_Conditions_Okay = "No" or Depression_Treatment_Time < 12 not 0"]

then it stops working correctly and automatically evaluates the entire thing as false. Obviously I'm not typing that criteria correctly, so how should it be written? The field is a number field, and I want it to terminate the questionnaire if someone types in a value less than twelve (as in months), but not if the field is left blank.

  • Newbies
Posted

Nevermind. I fixed it. I had to add another If line to the script below that to tell it how to deal with the Depression_Treatment_Time field when it's left empty. Thanks! For the benefit of anyone esle who's interested, the corrected script now looks like this:

If ["Medical_Conditions_Okay = "No" or Psych_Conditions_Okay = "No" or Depression_Treatment_Time < 12"]

If ["IsEmpty(Depression_Treatment_Time)"]

Go to Layout ["Alcohol, Seizure, Brain Injury"]

Halt Script

End If

Go to Layout ["Intro Time Ending"]

Else

Go to Layout ["Alcohol, Seizure, Brain Injury"]

End If

Posted

Hi Peter,

I think the expression should be:

If ["(Medical_Conditions_Okay = "No") or (Psych_Conditions_Okay = "No") or (Depression_Treatment_Time < 12) or (not isEmpty(Depression_Treatment_Time))"]

Hope it helps,

Ernst.

Posted

Seems it's parallel posting time again.

Time for some Alcohol. To celebrate that you got it working...

Regards,

Ernst.

Posted

[color:"blue"]

> Seems it's parallel posting time again.

> Time for some Alcohol. To celebrate that you got it working...

I think that, that is what happen's when it's a slow day, and a simple question comes along. smile.gif

I prepared a response too, but had to delete it because, when it posted, either Netscape or the Forum, changed one of the operators that I used, and it really screwed it up. This is the second day in a row that this has happened to me. Yesterday, I thought I had just hit the wrong key, been known to do that on occasion, however, I now see why Steve has put in these ( par.gifnotequal.gifless.gifgreat.gif ) for us to use because it is unpredicable when pasting them in, in Netscape. Strange that I never experienced this with IE.

Anyway, it nice that so many are here to help. Wished I had a question for you all

smile.gif

This topic is 7777 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.