HOME ➔ SUPPORT ➔ Community ➔ General CourseLab issues ... IF ELSE statement problem
IF ELSE statement problem
  View type:
I have an onclick action on a slide that looks like this:
(re-typed becuase copy/paste only works inside the editor)

IF(Condition='#select_var=='Sales Executive'')
GOTO - specified frame
IF (Condition='#select_var=='Sales Manager'')
GOTO - a second frame
GOTO - a third frame

The variable is set in the slide previous to this - but with module wide scope - using a dropdown list.

If I just view the slide with the action in - variable is unset - so it correctly goes to the third frame.

If I view the previous slide, and set the variable - which is confirmed with a frame that outputs the variable, then continue to navigate to my second slide - when the action is invoked, I get an error message which says:

line: 3241
Char: 2
Error: Expected ';'
Code: 0
URL - the start.hta file

Is there something wrong with the actions and their indenting? I need to get this right - I potentially have lots more variable values to add - each of which will navigate to its own frame.

It would be useful in future help files to show more examples of complex IF statement actions.

Many thanks

The indentation on the actions is not as represented above - after input into this form the disappeared.
I have now limited it down to the following to try and diagnose the problem:

IF(Condition='#select_var=='Sales Executive'')
[indent]GOTO - specified frame
[indent][indent]GOTO - a third frame

I now know that the variable is available to the slide - I used a textbox object to display the variable and it is there.

The problem is in the IF statement. PLease help
Further update.

It seems the IF statement works if the variable value is a number.

My problem then is I wanted to display the selected option using a text substitution.

So I tried to use a text substitution for the object property {{$OBJ_14.selectedName}} However this substitution did not work. The only propertys I can get to work in this way are the xy coordinates.

Hi, Richard!

1. Yes, I tested it too: there is a bug in IF. Under some conditions it may not compare string variables correctly. Fix will be issued next week.

2. Did you use TextBox' REFRESH method to update substitution? Substitution is made once when the object is created by run-time (but the property may be not available at this moment). Then you can use REFRESH to get current values.
Hi Slav and Richard,
just to confirm that the build: 071011 fix string compare very well.[:cool:]

Many thanks,

Hi Slav

I have built a short test module I can send you.

Slide 1 - form drop down list.(variable set to current module)
Slide 2 - relief text box with variable and object property substitutions.
Slide 3 - Relief text boxes which display depending on variable value

Slide 2 substitutions work for variable value, and object x,y,w properties. however, selectedName, value, disabled properties do not substitute, even after building a refresh method after display.

I can send it to you if you wish.

I have narrowed this down - it appears the variable is not available to the second slide. I tried to display it in a text box using {{#select_var}} - but the output is the call rather than the variable.

So why is it not being passed?

Message options
No additional options