Multiple OR and AND conditions in the same trigger

Hello everyone,

 

I am trying to create a 'search function', where users have to search for a person to add them on a list.

What I want my function to do (ignore case on all of them):

1.

(If LastName (variable 1) is equal to 'Zimmer'

OR LastName (variable 1) is equal to 'blank')

AND

(If FirstName (variable 2) is equal to 'Charles'

OR FirstName (variable 2) is equal to 'blank')

= Show Layer 1 (Continue the program)

2.

If LastName (variable 2) is not equal to 'Zimmer'

OR LastName (variable 1) is not equal to 'blank')

AND

(If FirstName (variable 2) is not equal to 'Charles'

OR FirstName (variable 2) is not equal to 'blank')

= Show Layer 2 (Try again message)

 

I cannot seem to find a solution for this. At the moment I have it set to:

1.

If LastName (variable 1) is equal to 'Zimmer'

OR

If FirstName (variable 2) is equal to 'Charles'

= Show Layer 1 (Continue the program)

2.

If LastName (variable 1) is not equal to 'Zimmer'

AND

If FirstName (variable 2) is not equal to 'Charles'

= Show Layer 2 (Try again message)

 

My problem with this way is that someone could type in 'Zimmer' as the last name but 'James' as the first name, and it will show them the Layer 1 (continue) and ignore the error. I need them to get either both names right OR keeping one field blank and one name right.

 

Anyone has any ideas? Happy to use Javascript if needed also, but might need a bit of a walk through :)

 

Your help is appreciated.

Joana

3 Replies
Louise Lindop

Hi Joana

I have an attached an example showing how you can do this with Javascript. Thanks Phil Mayor from a post about 6 years ago. I've added code to change whatever they type to lowercase so you can test the entry more easily.

Javascrip is:

var player = GetPlayer();
var a= player.GetVar("TextEntry");
var b= player.GetVar("TextEntry1");
var c= a+""+b;
player.SetVar("combinedtextentry",c.toLowerCase());

Hope this helps.

I've also attached another example which achieves the same using variables, but this doesn't handle the case as yet.

Louise

Ray Cole

This is not the sort of thing we should have to resort to Javascript for. Combining AND and OR conditions should be a built-in capability in Storyline. Why isn't it? It's just bizzare. Storyline doesn't stop you from combining ANDs and ORs when you are entering your conditional; it just silently doesn't work when you run the trigger. Come on Articulate, this needs to work properly without Javascript kludges! This is as silly as if you'd implemented a rule that + and - couldn't be combined in a basic arithmetic calculation.

    -Ray