Trying to CONCAT, but do not want to include "null"

Trying to change something that I have working with three columns of email addresses…
Now, I have four columns. Three always contain an email address. The 4th column only has an email address about 20% of the time. I CONCAT these columns into an “Added Column” with

{{(currentRow.staff_work_email}},{{currentRow.p_email}},{{currentRow.school_email}},{{currentRow.case_manager_email)}}

I use a modal to have people type a few notes. The email addresses then POST to a ticket system we use to create Help Tickets.

But, it is an issue to have email, email, email, null

Is there a way to remove the ,null when the 4th column is null?

Hey, Ideally something like the below should work for your fourth column, This is basically will replace the null value with empty string and otherwise render the email ID when present

{{currentRow.case_manager_email || ''}}

That only seems to work when that column is by itself.
{{currentRow.case_manager_email || ‘’}} will produce the empty string or the email

But when included with the others

{{currentRow.staff_work_email}},{{currentRow.p_email}},{{currentRow.school_email}},{{currentRow.case_manager_email || ‘’}} it still produces the ,Null

Got it, We will need something like a reduce here,

{{_.reduce(currentRow, function(sum, n) {
	if (n) return sum + n + ', '
	else return sum
}, '')}}

Here is how my output looks:

Very helpful. But, my table includes other columns. So the method would only work if I created another datasource/query to limit to just the emails.

Is it possible to use your reduce method, but specify the Columns to reduce?
Also, I’m not sure, but the trailing comma might be an issue. Is that possible to remove?

I’m sorry. I’m trying to improve my JS.