Post

3 followers Follow
0
Avatar

Leave calculation field empty when referring to invalid / empty data

I have used a calculation field to refer to a date field in another app. Sometimes the reference is invalid because the item does not exist or is not filled with a date or time. What I want is the calculation field to be empty ... or return another value like >> no appointment made.
So if invalid then leave empty... how can I solve this (now I get a sort of an error) >> Invalid date

Patriek Albers

Please sign in to leave a comment.

2 comments

0
Avatar

Hi Patriek,

is the calculation field date type (does it show the date like a real date field)? If so, you can't display a text like >> no appointment made.

The general direction:
var date = @all of Date field in the other app;
date == "" ? "" : moment(date).toDate() 

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink
0
Avatar

try this

var output = null;

if (datefield[0] !== undefined) {
  output = datefield[0];
}

output;

Rico Seiferth 0 votes
Comment actions Permalink