Formula Help - @Abs from Designer

I’m trying to use this formula from Designer, but can’t get my code to work. I keep getting ERROR: Incorrect data type for operator or @Function.

From Designer:@If( numDays = “”; 0; @Abs( @Integer( dateA - dateB ) / (60 * 60 * 24 ) ) )

Here is my code:

numDays = Number Field, Computed, @If( numDays = “”; 0; @Abs( @Integer( DspNextAuthDate - CurrDate ) / (60 * 60 * 24 ) ) )

DspNextAuthDate = Date Field, Computed, @Text(@Adjust(TCI_StartupDate;0;1;0;0;0;0) )

CurrDate = Date Field, Computed, @Text(@Today)

Can someone tell me why?

Subject: RE: Formula Help - @Abs from Designer

Your problem is the @Text in your computed field formulas. This makes the formula return a text value (surprise!). The return type of the formula overrides the datatype you have declared for the field.

Subject: RE: Formula Help - @Abs from Designer

Aaaaaah…that corrected it. I was using @Text because I was getting a “Cannot convert Number Value” or something like that and when I added the @Text to the fields it corrected it.

Thanks.

Subject: Formula Help - @Abs from Designer

You’ve said that numDays is a Number field so your formula will probably have to be:

@If( @Text(numDays) = “”; 0; @Abs( @Integer( DspNextAuthDate - CurrDate ) / (60 * 60 * 24 ) ) )

Emily.

Subject: RE: Formula Help - @Abs from Designer

Not sure I follow you…I followed the example in Designer. What do you mean the formula?

From designer:

This formula, for a computed number field called numDays, uses @Abs to calculate the number of days between two dates, which are stored in time fields dateA and dateB. @Integer(dateA-dateB) returns the number of seconds between dateA and dateB, so the formula divides by 606024 to get days. For example, if dateA is 08/11/95 and dateB is 09/22/95, the formula returns: 42.

@If( numDays = “”; 0; @Abs( @Integer( dateA - dateB ) / (60 * 60 * 24 ) ) )