When working with a date field, is it possible to ...
# general
n
When working with a date field, is it possible to measure the # of days between an old value and a new value within the system notes?
k
to_char({datefield},'j') - to_char({datefield2},'j')
but I wouldn't do it in system notes fields...
I'd find some other way of recording those changes.
system notes fields have terrible performance in searches
and you can wind up with multiple changes on a record - resulting in multiple lines
n
As it stands, I only have 1 field to reference, so I was hoping to use the new value - old value, but NS doesn’t seem to want to produce that. TO_CHAR({systemnotes.newvalue},‘j’)-TO_CHAR({systemnotes.oldvalue},‘j’)
k
That's probably not gonna work.
because new value and old value are text
so you'd have to do a TO_DATE({field},'Format of how date appears')
n
That produces an unexpected error 😕
k
Yeah, NS doesn't really like you working with system notes.
which was why my first answer was to try and do something to capture your field edits into a separate field.
n
Makes sense, I appreciate the guidance.
n
I’m thinking a Workflow will allow you to calculate/compare new v old record during a BeforeSubmit. Or alternatively in the workflow capture the value on entry and then compare to AfterSubmit.
1
k
Workflow will definitely do that.
n
{trandate}-{old.trandate}
n
Solved within the search by first determining which formula field to use, which was text. TO_DATE({systemnotes.newvalue},‘MM/DD/YYYY’)-TO_DATE({systemnotes.oldvalue},‘MM/DD/YYYY’)
Thanks for chatting with me on this one.