How to organise multipart answers to difficult questions?

So this comes in a couple of separate but interrelated (interwingled?) problems.

  1. I have a question broken down into the steps shown above. Semantically…what’s the best way to label them which clearly shows where the answer in in relation to the overall solution? Answer Part 1, 1 of 2 or something else?

2.TWiki code NEEDED: No matter what naming convention I use I need all the answers and sub answers to point back to the same question. (And possibly back up to the previous level of answer?).

Answers currently start with A: and have the same name as the question which starts with 'Q: ’

It I understand the question, I’d create two list fields for an answer tiddler:

list fields: question and answer.

The question list field lists tiddlers for any question it answers.

The answer list field optionally lists tiddlers for any parent answer tiddler.

It would be up to you if the question field should be empty if a parent answer field is populated. I think I would do this.

Technically, if you define that answer can only have 1 question and optionally only 1 parent answer, then these fields are not list fields, but rather title fields.

You’d have to recurse the hierarchy. In fact there are tree plugins that could draw your diagram if needed.

Does this make sense?

1 Like

(post deleted by author)

I actually think that the labels you have there are just fine for labeling them. An alternate version might be A: Winding Demo 1.1.2, but I think just as you have them is fine. Use captions if you want a more pleasant display of their titles. One big advantage of the style you have now is that you can derived the hierarchy directly from the titles. No need to fiddle with parent fields or children list fields.

If you do go this route, then we can have straightforward answers to this question:

We can use code like this:

<$let 
  question={{{ [<currentTiddler>removeprefix[A: ]search-replace::regexp[(\/\d+)+$],[]addprefix[Q: ]] }}}
  parent={{{ [<currentTiddler>search-replace::regexp[\/\d+$],[]] :filter[is[tiddler]] }}}
>

to derive the Question and (when applicable) the parent from any part of a template for Answer tiddlers.

And we can get the children of any question or answer with a function like this:

\function get.children(ans) 
  [prefix<ans>] -[<ans>]
  :filter[trim:prefix<ans>regexp[\/\d+$]!regexp[\/\d+\/\d+$]]
  +[format:titlelist[]join[ ]]
\end

If we wanted, we could write some recursive tool to show the entire hierarchy of a Question and its Answer(s), perhaps highlighting the current node, and put the result in the footer of each tiddler. I didn’t go that far, but I did create a little demo you can try: QandA.json (2.4 KB)

Here’s how a few of the tiddlers look:

Only a few of the tiddlers have captions, but that’s easy to remedy. If you’re interested in the kind of hierarchical view I mentioned, let me know if you need help. I’ve done things like it a few times.

1 Like