How to generate doc content from table?

Hi there @Giuseppe_Birardi :blush: ! Welcome to Coda :grin: and to the Community :tada: !

It is doable :blush: but depending where you want to put your desired output, it might require some adjustments :blush: .

So, in the sample below, I’ve kind of reproduce your screenshot and to get your desired results, in the table Subtasks I’ve created the Reference fields [Tasks] and [Activity Owner] both of which just show those info you’ve entered in your Tasks table :blush: .
(Sorry, I’m enable to find another way to say this :sweat_smile: )

Now, on the canvas of my sample, you’ll see 3 very similar canvas formulas :blush: .

They do the same thing but one keep the reference to your [Activity Owner], [Tasks] and [Subtasks] and the other don’t and the last one creates a Bulleted List :blush: .

The formulas looks like this :

Subtasks.FormulaMap(Format("{1} in {2} will take care of {3}",CurrentValue.[Activity Owner],CurrentValue.Tasks,CurrentValue)).Join(Character(10))

Put into words, it kind of says :
For each subtasks (FormulaMap()) in the Subtasks table (each specific Subtask is represented by CurrentValue), follow this text pattern (Format()) and then, join them (Join()) using a Character(10) (Character()).

Character n°10 in Unicode is the one for a line feed/Newline (so each Subtasks the formula uses begins with a newline, otherwise, the text is just displayed inline in the formula on the canvas :blush: )

And concerning the Format() formula, here :

  • {1} = CurrentValue.[Activity Owner]
    (the owner of this specific Subtask in the list of all Subtasks)

  • {2} = CurrentValue.Tasks
    (the Task linked to that specific Subtask in the list of all Subtasks)

  • {3} = CurrentValue
    (the specific Subtask in the list of all Subtasks)

The list of all Subtasks being the Subtasks table :blush: .

And just in case, if you need more info about FormulaMap(), take a look at this topic here :blush: . It helped me a lot with this specific formula :grin: !

5 Likes