Hi, I am trying to concatenate text from multiple columns into a formatted cell (see below). So far I am here
join($column1$,"\r\n",$column2$,"\r\n",$column3$) using String Manipulation node, but still missing a way to insert column names and hopefully add text format.
Start date: May-01
Last name: Welch
Start date: May-05
Last name: Williams
I used a column rename node to add the columns as variables. I am not sure if this is the most efficient way to do get to the desired result but I am one step closer
@JulioCesar , new column is a default name for String manipulation node. Just change it to Notes.
Maybe you can use “extract column header” node and “table row to variable” node instead of column rename .
From the variable you can get the column names.
Though it won’t be completely dynamic, it might help you
Hi @izaychik63, I didn’t mean renaming the column but writing a column name and its corresponding value inside a cell.
Yes, but then I duplicate the number of columns I have on my table.
@JulioCesar the white fields would contain the content of the variable after the node has finished so your flow variable
“111” would contain whatever old name you have put in for the first column you tried to rename. You can then use that.
If you want to set a name from a flow variable you would have to use the grey fields to the left. If you want the new name you would have to use that line.
But maybe we do not fully understand your tasks. Maybe you can provide an example in a workflow and explain how the result with the renamed columns should look like.
I think this can help
In the end however, you need to manually update the column expressions node if a new column is added
Hi @JulioCesar , alternatively, you can use Columns to JSON which will give you something in the same format that you are looking for, and it’s dynamic as in you don’t have to change anything if your table changes (new columns, less columns, it does not matter).
Just plug it to your data:
And for fun, I added 2 extra columns:
Re-ran the same node without any modifications, and I got this:
You can do some cleanups if you really want the format that mentioned. You can use the String Manipulation:
You can for example convert the JSON to a string like this:
Or even clean up the JSON formatting completely:
, "\"", "")
, ",\r\n", "\r\n")
Here’s the workflow: Concatenate cells into a paragraph with column names.knwf (8.8 KB)
This is indeed a more elegant way to do what I was originally attempting, thanks.
Thanks, super creative with the JSON cleanup
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.