New To TrueContext

 View Only
  • 1.  Conditional logic

    Adopter
    Posted 03-08-2024 13:57

    Is it possible for conditional logic to be utilized between a repeatable section and a normal section in the form? What I want to happen is if a button question is answered no in a repeatable section I want a section of the form that is not in the repeatable section to no be visible on the reports or the device.



    ------------------------------
    Jason Schuelke
    Safety/Superintendent
    Highmark Erectors inc.
    ------------------------------


  • 2.  RE: Conditional logic

    Posted 03-08-2024 19:11

    Hi Jason!

    Conventionally, conditional logic within a repeatable section can't change objects outside of that repeatable section record. The best way to think about it is each "entry" in a repeatable section is it's own little entity. However as you've likely found, you can use items from the "base" form can be used in repeatable section conditional logic - although this doesn't solve your problem.

    I believe I understand your problem, however!

    Let's say (for example) you have a repeatable section with 10 entries in it. For each entry, there's a question "Has the ___ passed safety inspection", and should ANY of the entries be answered "No", then something later on in the form will be shown/not shown. You'd use hidden fields to achieve this, specifically a text field. Then, you extract the info from the repeat using an aggregate question at the bottom of the form. I'll try and draw this up for you.

    REPEAT QUESTIONS
    --------------------------------
    Asset Name: _______ (Text field)
    Has Asset Passed Safety : [Yes/No] Button group
    FailedSafety: (Hidden text field, set to "Numeric")


    Now, setup a conditional logic rule (in the repeat):
    IF [HasAssetPassedSafety] == "No" THEN SET [FailedSafety] IS SET TO "1"

    In the footer of the repeat, you would then add a "Aggregate" question (We'll call it [FailedSafetyCount]), and use the "SUM" function, selecting [FailedSafety] as the object to SUM. This field would then display a value of 0 if all lines passed the safety question. If 3 lines failed, it'd read 3, and so-forth.

    Now you can setup a conditional logic rule in the base of your form something like: 

    IF [FailedSafetyCount] IS GREATER THAN [0] THEN IGNORE [Section Name]

    That's the general method, however you may need to alter this logic a bit depending on your exact use case. Hopefully I've conveyed the gist of how to achieve what you need, however I'd be happy to answer any questions if you're still scratching your head on this one.

    Thanks for being a part of the community!



    ------------------------------
    Paul Hattlmann
    Sales Engineer
    TrueContext
    Toronto
    ------------------------------



  • 3.  RE: Conditional logic

    Posted 03-12-2024 16:13

    As with a lot of things in TrueContext, there are typically a couple ways to accomplish the same outcome so I just wanted to mention a slightly less used feature in our product that should also help you with this, Answer Exceptions in conjunction with a Recap question. Here are the docs for our Recap question: https://docs.truecontext.com/1374411/Content/Published/360021669952.html?Highlight=recap 

    One big difference with this, I will point out, is that when an answer exception is triggered (good or bad) it will highlight the row of the repeat section with the colour that you have set up, but what this will allow you to do is to use the Recap question to summarize the number of times an answer exception is triggered and then use Conditional Logic based on that. 

    So what you can do is:
    1. Create an answer exception (https://docs.truecontext.com/1374411/Content/BuildAndManageForms/CreateOrEditAFormWithTheFormBuilder/IntroductionToTheFormBuilder/360000783666_AnswerExceptions.html?Highlight=answer%20exception)

    2. Assign the exception to the button group question in the repeat

    3. Create a Recap question outside of the repeat section pointing to that exception category

    4. Using Conditional Logic, do the same as above, IF Recap > 0 THEN Ignore Section ELSE Dont

    Both methods (Hidden number field with the aggregate or the Answer Exceptions) will give you the exact same results at the end but really just wanted to mention it as an alternative. 



    ------------------------------
    Ian Chamberlain
    Solutions Architect
    TrueContext
    ------------------------------



Reminder: Content posted to our Community is public content.  Please be careful not to post Intellectual Property that you do not have permission to share.  For more information please refer to our Terms Of Use