Action conditions - AND and OR

rgs55 Community Member Posts: 38
I would like to see compound conditions, so I can set up something like this:

(Chapter "Is Completed" OR Chapter "Is In Progress") AND var_MenuType "Equal To" Forced_Order

I resolved this by setting up two actions, but it would be a nice to have, if I could do it in one. (Or in this particular example, it would be nice to have an "Is Not Completed" scenario. :-)


  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    it would be nice to have an “Is Not Completed” scenario.
    I think the "Is not started" condition is exactly what you need ;)

  • dfleary
    dfleary Community Member Posts: 82 ☆ Roadie ☆

    Yes, compound conditions using status is a little more difficult. As Roz suggests, it's not easy to test "Is Not Completed" (meaning the target has not been started by the student or is still in progress) AND another condition. But I'm happy to say that will all change with the next version of Lectora and Lectora Online! As Sergey suggests, there will be "inverse" conditions for status:

    In addition to the current relationships:
    - Is Not Started
    - Is In Progress
    - Is Completed

    You will also have available:
    - Is Started (meaning the target is either In Progress or Is Completed)
    - Is Not In Progress (aka Is Not Started or Is Completed)
    - Is Not Completed (aka Is Not Started or Is In Progress)

  • tecocat
    tecocat Community Member Posts: 389 ♪ Opening Act ♪
    I've been wanting more sophisticated Boolean logic FOREVER! I want to be able to use conditions like "If x AND (y OR z)" or "If a AND b, but not (c OR D)," etc. Sometimes I can get there by creating a bunch of temporary variables and lots of actions, but sometimes even that won't do the trick (and, when it does, it's really cumbersome). I think I've been asking for this for about 8 years now...maybe 2016 will be the year my dream comes true?
  • kselement
    kselement Community Member Posts: 17
    Im needing the OR condition right now. Im not sure how to implement this. Is there any other way?
    If varX contains Y OR Z then true.


    Any ideas?
  • tecocat
    tecocat Community Member Posts: 389 ♪ Opening Act ♪
    Oh, if you just need a plain "OR," that's easy!  Just pick the "Any" instead of the "All" option! :)
  • kselement
    kselement Community Member Posts: 17
    I wish it was that simple, Laura, but I also have other conditions that also need to be true and unfortunately i need the "All" :(
  • tecocat
    tecocat Community Member Posts: 389 ♪ Opening Act ♪
    Okay - well, then, you'll need two separate actions. (For lack of detail in your reply, I'm going to assume that your situation is that you need A, B, and C to be, say, "correct" and then either D or E to be "correct" as well.)

    Set up an "ANY" action that tests whether  D or E is "correct." If either of them is correct, then set a custom variable (we'll call it "DorECorrect") to equal "1."

    Then set up an "ALL" action tests whether A  is correct, B is correct, C is correct, and DorECorrect equals 1.

    That should do the trick! :)
  • klaatu
    klaatu Community Member Posts: 988
    Until these goodies are added to the action system, here is a crude example of what you can accomplish with a few lines of JavaScript. The idea is to show how this can be used to accomplish all these requests and more. The sky is the limit.

    I'm sure, as Laura shows in the post above, that you can figure out a way to get the same results using the current action system but I think it would take a lot of extra steps (and I'm lazy).

    If you are not familiar with JavaScript (and if you are, I'm sure there is a more elegant way to code this) and you would like me to explain how this works in detail shoot me a message and/or (pun intended) let me know here in the forum and I will put something together.

  • klaatu
    klaatu Community Member Posts: 988
    Sorry, that was the published files. Here is the AWT.