2 followers Follow

Date and 2 calculations with Syntax errors

I have an App in that app I'm using 3 fields to track assets and know when they have hit their 10 year or older mark.

-The First field(Date of Manufacture) is a date field using only a "start" date( no times or end date)

-The second field(DoM Years) is a calculation field, which is to calculate years the asset has been in service, the calculation I am using is 

     var d1 = moment(@Date of Manufacture);
     var d2 = moment();
     var result = d2.diff(d1, 'years');

-The third field that I'm having trouble with is an if then statement 

I need the third field to reference the second field's calculation and if the years are equal to or greater than 10 years mark it as 'yes' and if it is less than 10 years mark it as 'no' this is what my brain types it as but the syntax is wrong 

{if (@DoM Years >= '10' "yes")
else 'no'}

Jabin Young

Please sign in to leave a comment.

1 comment


Hi Jabin,

it's either: 

if (@DoM Years >=  10){

or shorter: 
@DoM Years >=  10 ? "Yes" : "No"

But be careful with the calculation in DoM Years. I've described the issue with moment() = current date here:


Rainer Grabowski 0 votes
Comment actions Permalink