Post

2 followers Follow
0
Avatar

Removing "undefined" from markdown table in a calculation field

Hi All, 

The table below was created using a markdown table in a calculation field. How do I replace an "undefined" result with something like "-"?

 

 

Richard Hedger

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Richard,

I assume you have 
.join("\n") in your table calculation . 
Add
.replace(/undefined/g,"-")
right behind .join("\n")

Rainer

Rainer Grabowski 0 votes
0
Avatar

That did the job - thanks.

 

A little bit on the same theme, is there a way to not display the column titles is there is nothing to display? In other words, the field is empty.

Richard Hedger 0 votes
0
Avatar

Declare the table as a variable: 

var table = 'date |  etc (all the code for the table)

and then: 

lines == "" ? "" : table

Rainer

Rainer Grabowski 0 votes