Following-up on this question, I'm using the now attempting to implement a review screen, which will re-evaluate the off-ramp.
The code works this way:
- user makes selection [mandatory code triggers question] ... one of the options gives the value "not_supported"
- if user chooses unsupported feature, is sent to a "not supported" screen [event] - they must then click "back" to continue the interview and re-enter the information at the screen at item 1
- once user makes a supported selection, they eventually end up at a review screen
What's happening now is that if the user, on the review screen, chooses the "not supported" feature from the screen at item 1 above, they still go back to the review screen, but with the "not supported" selection as a variable (not the desired behavior).
One idea is to simply stop showing that selection if it has been chosen previous (i.e. if the user has previously been told that option is not currently supported) per this question. That's only a partial solution, though, because if the user hasn't chosen the unsupported option at some point, that option can still be selected from the review screen. I'm running into a small problem here, though in that I'm setting a "flag" variable in my code (see below) to remove the option using 'show if': not not_supported_shown_flag
, which actually works great, except that hitting "review" from a review screen unsets it -- QUESTION 1: is there a way to prevent that from happening (i.e. to "review-proof" certain variables?).
For the larger issue, I thought there was probably a solution by including the code with a initial
specifier (or another logic control specifier). Eg:
mandatory: True
depends on: var
code: |
if var == "not_supported":
not_supported_shown_flag = True # the "offramp taken flag" variable, meant to remove the non-supported option from future visits to that screen by the user
not_supported_event_screen # the "off ramp"
The problems I'm running into now is that, following the top answer on this question are that:
- the "back" button takes the user back to the review screen without triggering
not_supported_event_screen
- all sorts of chaos then ensues, including that (a) the user is still able to advance past the review screen by clicking "resume" and then at any point subsequent if they hit back they are taken to the
not_supported_event_screen
, and (b) when the user clicks "revisit" again, they are taken tonot_supported_event_screen
, where the "Exit" and "Exit and clear answers" buttons don't work as expected.
QUESTION 2: wondering if there's a best-practice / accepted method for solving for this sort of situation? Initial
and reconsider
seem unnecessarily process-heavy because they'd call the code block (if I understand correctly) every time the screen changes (not that I expect process-intensity to make a noticeable difference here). mandatory: True
appears necessary, or the code block doesn't run on the first pass (only when recalculating).
Ideas I have had include:
- Breaking-up the code that sets the
not_supported_shown_flag
and thenot_supported_event_screen
into two separate code blocks, to use two separate logic control modifiers - Using
code
on the actual question / specific answers to the question (I'm not sure if that's possible, because the question has been created in the format shown here). - Somehow forcing certain questions / review pages to "refresh" and thus trigger code blocks (the lack of which I suspect is part of the issue).
I'm just really not sure what the solve is - it seems like going "back" doesn't constitute a refresh sufficient to trigger a "refresh," and review pages work to some degree similarly as "events."