How to generate doc content from table?

Is it possible to generate text from a table?

A minimum example would be something like:

Table:

image

Text pattern:

[Task Owner] in [Tasks] will take care of [Sub-tasks]

Desired Output:

“John in Task 1 will take care of Sub task 1”
“Jeoff in Task 2 will take care of Sub task 2”
“Jeoff in Task 2 will take care of Sub task 3”

I’m really new to Coda and don’t know it’s the right tool to achieve such functionalities.

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

Hi @Pch , thanks a lot for your examples! It really clarifies me how coda works with tables. I’ll try to dive into FormulaMap() and see if i can obtain my desired output.

1 Like

You’re Welcome @Giuseppe_Birardi :blush: !

Good luck with FormulaMap() :wink: !

Depending on how you use Coda, this is a formula you might never encounter or barely use, but it’s an important one and not necessarily the easiest to grasp :no_mouth: .

Fortunately, the examples and explanations from other users in the topic I shared in my previous reply are very helpful :blush: .

1 Like

I got procedural proramming, then object orientation was ok. Never really got into functional, and now CODA has a complete different structure. I’m getting to old for this… :wink:

1 Like

We’re never too old to learn new things :wink:
Life would be pretty boring if it was the case :wink: (IMHO).

1 Like