Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread about the formula of calculation field.
Wed, Feb 10 2016 6:04 AMPermanent Link

宮腰 具明

SISAN SYSTEM RESEARCH. Co. Ltd.

Avatar

Please tell me about the formula of calculation field.

Field definition

Building_Date: TDATE
years        : Integer

"years" is Formula field
Calculation formula is
(Current_Date - BuildDate) / 365)

This will work well.
I want to make changes in the following manner

IF (BuildDate  > CAST('1899-12-31' AS  DATE) , (Current_Date - Building_Date) / 365) ,0)

It does not work.

(Current_Date - Building_Date) / 365) will have returns 0.

????.

What is wrong?

and I want, in the following manner, if possible
"IF (BuildDate  > CAST('1899-12-31' AS  DATE) , (Current_Date - Building_Date) / 365.25) ,0)"

Thank you

Tomoaki Miyakoshi
Wed, Feb 10 2016 6:07 AMPermanent Link

宮腰 具明

SISAN SYSTEM RESEARCH. Co. Ltd.

Avatar

I made a mistake...

"BuildDate" is "Building_Date"

Thank you
Wed, Feb 10 2016 6:12 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Tomoaki,

<< Please tell me about the formula of calculation field. >>

Just to clarify: are you trying to define an ElevateDB COMPUTED or GENERATED column in a table, or a calculated TField in your Delphi/C++ application ?

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Feb 10 2016 7:15 AMPermanent Link

宮腰 具明

SISAN SYSTEM RESEARCH. Co. Ltd.

Avatar

Tim,

Thanks for the reply.

I'm using the DelphiXE and ElevateDB 2.21.
I am trying to modify the table definition of elevateDB.

The value of the field "Build_Year" of Table is, to calculate the EDB. And, I want to use in my application

"Build_Date" DATE DESCRIPTION 'Jap &#24314;&#31689;&#24180;',
"Build_Year" INTEGER COMPUTED ALWAYS AS (Current_Date - Build_Date) / 365 DESCRIPTION 'Jap &#31689;&#24180;&#25968;',

I want to re-defined using the EDBmgr .

What does this message has become the answer to your question?
(I am making a sentence in the Google translation feature.)

Thank You.

Tomoaki Miyakoshi
Thu, Feb 11 2016 6:38 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Tomoaki,

<< The value of the field "Build_Year" of Table is, to calculate the EDB. And, I want to use in my application

"Build_Date" DATE DESCRIPTION 'Jap &#24314;&#31689;&#24180;',
"Build_Year" INTEGER COMPUTED ALWAYS AS (Current_Date - Build_Date) / 365 DESCRIPTION 'Jap &#31689;&#24180;&#25968;',

I want to re-defined using the EDBmgr . >>

Okay, this is the expression that you want for a COMPUTED column definition:

(CURRENT_DATE() - Build_Date) YEAR

That will return the number of years between the current date and the value in the Build_Date column.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Feb 11 2016 9:29 PMPermanent Link

宮腰 具明

SISAN SYSTEM RESEARCH. Co. Ltd.

Avatar

Tim,

<<(CURRENT_DATE() - Build_Date) YEAR >>

I was successful confirmed the operation!
Thank you very much!!

I have found it possible to communicate in English to create. I also will question the future
Thank you.

Tomoaki Miyakoshi
Fri, Feb 12 2016 6:14 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Tomoaki,

<< I have found it possible to communicate in English to create. I also will question the future >>

Excellent, please feel free to do so. Smile

Tim Young
Elevate Software
www.elevatesoft.com
Image