This topic contains 4 replies, has 0 voices, and was last updated by tgrimm 8 years, 4 months ago.
-
AuthorPosts
-
June 1, 2016 at 2:44 pm #2015
Celigo PS 3I have a custom record with a field of type Integer. There is a default value of 0 set in the field definition (because I was having trouble with nulls). The value is updated nightly by a workflow, if needed. It is a stored value. I want to see if the value is greater than 15 using Freemarker in an email template. I tried the following:
But I get an error upon saving the template that says: The only legal comparisons are between two numbers, two strings, or two dates.. Left hand operand is a com.netledger.templates.model.EmptyModel. Right hand operand is a freemarker.template.SimpleNumber.
I did some digging on this forum and found a post that suggested using ?number as follows:
But now I get this error upon saving: “expecting a number here found: ”
This seems pretty straightforward to me. I just need to do a simple comparison of an integer field. Anyone have any ideas what I am doing wrong here?
This is a cached copy. Click here to see the original post. -
June 1, 2016 at 3:57 pm #2016
egrubaughWas the field or the default value added after you already had some instances of the record created? Seems to me like there are some instances of your custom record where custrecord330 has no value in it.
-
June 1, 2016 at 6:55 pm #2017
michoelOriginally posted by egrubaugh
View Post
Was the field or the default value added after you already had some instances of the record created? Seems to me like there are some instances of your custom record where custrecord330 has no value in it.
If this is the case, supplying a default value in the Freemarker code should solve it.
Code:
-
June 3, 2016 at 5:01 pm #2018
Celigo PS 3I tried setting the default value as specific above (thank you!) and now I am getting this:
Expecting a boolean (true/false) expression here. Expression customrecord.custrecord330!0 gt 15 does not evaluate to true/false . it is an instance of com.netledger.templates.model.EmptyModel
I also tried it with the ?number exactly as in the above reply and got the same error. So, at least I’m getting a different error… it’s as if NS is not recognizing the datatype of the custom record field as an integer. I thought dates were hard…
-
July 6, 2016 at 9:04 am #2019
tgrimmAre you certain you have the correct syntax for the field you are attempting to compare? I would suggest first attempting to display this value first just to make sure you have the correct field. Based on the error it seems like the field doesnt exist so you are trying to compare a value to something that is NULL, or falsy.
-
AuthorPosts
You must be logged in to reply to this topic.