```"Your formula has an error in it. It could res...
# ask-stanley-ai
r
Copy code
"Your formula has an error in it.  It could resolve to the wrong datatype, use an unknown function, or have a syntax error.  Please go back, correct the formula, and re-submit.<BR><BR> Search: Transaction Search<BR>Formula: TO_DATE({today}, 'YYYY-MM-DD HH24:MI:SS') - {datecreated}",
c
AI generated answer (using internal Slack threads):
The error you're encountering is likely due to the data type mismatch in your formula. When subtracting two dates in NetSuite, the result is an integer, not a date. Therefore, you should use
Formula(Numeric)
instead of
Formula(Date)
. Here are a few suggestions on how you can correct your formula: 1. Use
{today}-{trandate}
as your formula and set the formula type to
Formula(Numeric)
. This will subtract the transaction date from today's date and return the difference in days as an integer. 2. If you want to handle null values, you can use the
NVL
function or a
CASE
statement. For example, you can use
NVL({custbody104}, TO_NUMBER(ROUND({today}-{trandate})))
or
_CASE WHEN {custbody104} is NULL THEN TO_NUMBER(ROUND({today}-{trandate})) ELSE {custbody104} END_
. 3. If you still encounter issues, you can try using the
TO_DAYS
function, like so:
TO_DAYS({today}) - TO_DAYS({trandate})
. This function converts a date to a number, which can then be subtracted. Remember to test your formula in a different context if you're still encountering errors. This can help you isolate the issue and find a solution. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.888013482
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.885178208
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.884101033
Please provide your feedback on this answer.