#1 2019-05-03 17:34:33

Mo0211
Member
Registered: 2018-12-30
Posts: 15

TDateTime Functions in Aggregate Mode

Hi,

Are there implemented Methods to get Values from a Specific Month, Day, Year or others?

For example i want to get the sum of a column from a specific month of a TDateTime Object.

Thanks for any advice!

Moe

Offline

#2 2019-05-03 20:07:42

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: TDateTime Functions in Aggregate Mode

Using the ORM? or SQLite3?

Offline

#3 2019-05-04 07:32:13

Mo0211
Member
Registered: 2018-12-30
Posts: 15

Re: TDateTime Functions in Aggregate Mode

Hi ab,

preferred with ORM.
My goal is to change the current usage from sqlite and mysql to the general ORM format, which is really pretty straight forward and simple (when you know how to use it wink ).

The query in sql is clear.

Is this possible with ORM?

I asked many questions in the last time.
Are those functions documented and i didn't find them?
i don't want to bother you, but for me it is hard to find the correct usage for those questions.

One last compliment - your support here in the forum is really great!
This is one reason to use mormot!

Offline

#4 2019-05-09 19:54:18

Mo0211
Member
Registered: 2018-12-30
Posts: 15

Re: TDateTime Functions in Aggregate Mode

Hey ab,

any news here?

Thanks for your answer.

Offline

#5 2019-05-10 08:08:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: TDateTime Functions in Aggregate Mode

The ORM doesn't touch/adapt the functions passed.
So standard SQL aggregation like sum() or count() or max() will work - also for MongoDB, where there is functions parsing.

Date/time functions won't probably be portable, thought... and should be tuned for each DB engine I guess.
Under the hood, TDateTime are stored as ftDateTime, which should be the native date/time column type of each DB: so you could be able to use the specific DB date/time functions.

What we would do in such cases, is to add some integer fields with the proper value (e.g. a new Day field), populating them together with the decoded value.
And search in them directly.

Offline

Board footer

Powered by FluxBB