Multiple levels of conditional text



  • For a report builder, my non-technical users need to be able to visually specify conditional text that is potentially multiple levels deep. Example:

    Mr X and Mrs Y, each possibly replaced by Mr Z if the deal is signed after 4th January, hereby sell their 342 non-voting shares to Acme Inc.

    This entire sentence may be subject to a condition (so that it may get removed from the paragraph if the condition is not met). But also within this sentence, several elements could be conditional, or replaced by alternative text depending on conditions. For example:

    • instead of Mr X and Mrs Y, we could be dealing with only one person, or instead four persons
    • the "each possibly replaced by Mr Z..." may get removed in its entirety
    • the "their 342 shares" could also be "his 24 shares" or "her single share"

    And within those word groups even deeper conditionality may occur, e.g.

    • the "non-voting shares" may get removed, or replaced by "voting shares"
    • the "if the deal is signed after 4th January" may get removed or replaced by entirely different wording
    • even deeper, the "4th January" may get replaced by a description of the date, instead of a hard-coded date

    Enabling users to visually select words and attach a condition or alternative text is not a problem for the first level. You can simply highlight those words and show a popup-editor to specify the condition and/or alternative.

    The problem starts from the second level, where users need to be able to select words within other text that may itself be conditional or already replaced by other text. This seems difficult to express in line-based editors.

    Are there any good suggestions, or existing software applications to learn from?

    • We have already explored the option of a domain-specific language, but it is too hard to learn for many non-technical users.
    • It could be envisaged to allow users to "drill down" on conditional elements (so they are only presented with elements of the current level), but I am afraid this is also complex for many users.

    EDIT: To clarify, I'm not looking for advice on how to build a nested boolean editor (although that's an interesting problem by itself). Instead, I'm looking for advice/examples on how to visually present text and text-within-text-within-text that can become the "target" of some boolean condition.

    The following example is one possible solution that I built myself, but it's kind of ugly, and users don't really like it.

    Example editor



  • You might look at some flow builder or rules engine patterns that support multiple levels of and/or conditions. In these patterns we often see the second level conditions indented or placed in their own container boxes to distinguish them from first-level conditions.

    They can be fairly inline, like this example from FreshWorks:

    FreshWorks flow builder example

    They can also be canvas-based, like this example from ZenDesk:

    ZenDesk workflow

    You might want to bring engineering into the discussion to see what's technically possible.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2