Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TClientDataSet and Filtering on a calculated field


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Aug 27, 2017 11:39 PM Last Post By: Bernd Maierhofer
David Smith

Posts: 7
Registered: 6/15/14
TClientDataSet and Filtering on a calculated field  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 24, 2017 7:55 AM
Hi all. I have a mapping application that takes client data from an Oracle database and then shows it pictorially over a map of the UK using tmsSoftware's component and this works well. It shows a heat map type display around the various company offices.

For this I use a calculated field using the OnCalc event to generate the distance in miles from the office that services that client to the client's home address. I also have a calculated field that - as the name implies - calculates the distance from the client's home address to any specified postcode that our business wants to put on an 'event' at. Again this works well in that you can see what clients live around, i.e. within a certain distance of, specified 'event' postcodes.

However, I want to provide the facility to export the data to spreadsheets - as all financial firms like their data in spreadsheet form!! - perhaps to be used for mail-merge purposes etc. Iterating through the TClientdataset (and it really is a client data set) and putting markers on a map based upon the calculated field is all well and good, but filtering to create an export file using a filter naturally doesn't work because you cannot filter on a calculated field.

So the question is - how to create any form of data set that is the result of a filter based upon a calculated field? I have shied away from using the OnFilter record because the filter definition can be quite complex and there are lots of records to filter - hence it would be slow. But is this the only way we can get a filter based upon a calculated field still?

Many thanks in anticipation of your help and with kind regards

David
Bernd Maierhofer

Posts: 161
Registered: 9/27/99
Re: TClientDataSet and Filtering on a calculated field  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 24, 2017 11:00 PM   in response to: David Smith in response to: David Smith
David Smith wrote:

Hi all. I have a mapping application that takes client data from an
Oracle database and then shows it pictorially over a map of the UK
using tmsSoftware's component and this works well. It shows a heat
map type display around the various company offices.

For this I use a calculated field using the OnCalc event to generate
the distance in miles from the office that services that client to
the client's home address. I also have a calculated field that - as
the name implies - calculates the distance from the client's home
address to any specified postcode that our business wants to put on
an 'event' at. Again this works well in that you can see what clients
live around, i.e. within a certain distance of, specified 'event'
postcodes.

However, I want to provide the facility to export the data to
spreadsheets - as all financial firms like their data in spreadsheet
form!! - perhaps to be used for mail-merge purposes etc. Iterating
through the TClientdataset (and it really is a client data set) and
putting markers on a map based upon the calculated field is all well
and good, but filtering to create an export file using a filter
naturally doesn't work because you cannot filter on a calculated
field.

So the question is - how to create any form of data set that is the
result of a filter based upon a calculated field? I have shied away
from using the OnFilter record because the filter definition can be
quite complex and there are lots of records to filter - hence it
would be slow. But is this the only way we can get a filter based
upon a calculated field still?

Many thanks in anticipation of your help and with kind regards

David

Have a look at internal calculated fields.

Additionally, when the filter is needed for exporting only, you might
also be fine with looping and an if-condition-then-export, instead of
filtering.

hth Bernd

--
David Smith

Posts: 7
Registered: 6/15/14
Re: TClientDataSet and Filtering on a calculated field  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 25, 2017 2:32 AM   in response to: Bernd Maierhofer in response to: Bernd Maierhofer
Bernd, many thanks for that - I've not come across these internal calculated fields before so will investigate as I'm sure this sort of requirement must be seen by many developers.
kind regards

David

Bernd Maierhofer wrote:
David Smith wrote:

Hi all. I have a mapping application that takes client data from an
Oracle database and then shows it pictorially over a map of the UK
using tmsSoftware's component and this works well. It shows a heat
map type display around the various company offices.

For this I use a calculated field using the OnCalc event to generate
the distance in miles from the office that services that client to
the client's home address. I also have a calculated field that - as
the name implies - calculates the distance from the client's home
address to any specified postcode that our business wants to put on
an 'event' at. Again this works well in that you can see what clients
live around, i.e. within a certain distance of, specified 'event'
postcodes.

However, I want to provide the facility to export the data to
spreadsheets - as all financial firms like their data in spreadsheet
form!! - perhaps to be used for mail-merge purposes etc. Iterating
through the TClientdataset (and it really is a client data set) and
putting markers on a map based upon the calculated field is all well
and good, but filtering to create an export file using a filter
naturally doesn't work because you cannot filter on a calculated
field.

So the question is - how to create any form of data set that is the
result of a filter based upon a calculated field? I have shied away
from using the OnFilter record because the filter definition can be
quite complex and there are lots of records to filter - hence it
would be slow. But is this the only way we can get a filter based
upon a calculated field still?

Many thanks in anticipation of your help and with kind regards

David

Have a look at internal calculated fields.

Additionally, when the filter is needed for exporting only, you might
also be fine with looping and an if-condition-then-export, instead of
filtering.

hth Bernd

--
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: TClientDataSet and Filtering on a calculated field  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 25, 2017 10:17 AM   in response to: Bernd Maierhofer in response to: Bernd Maierhofer
Bernd Maierhofer wrote:
David Smith wrote:

Hi all. I have a mapping application that takes client data from an
Oracle database and then shows it pictorially over a map of the UK
using tmsSoftware's component and this works well. It shows a heat
map type display around the various company offices.

For this I use a calculated field using the OnCalc event to generate
the distance in miles from the office that services that client to
the client's home address. I also have a calculated field that - as
the name implies - calculates the distance from the client's home
address to any specified postcode that our business wants to put on
an 'event' at. Again this works well in that you can see what clients
live around, i.e. within a certain distance of, specified 'event'
postcodes.

However, I want to provide the facility to export the data to
spreadsheets - as all financial firms like their data in spreadsheet
form!! - perhaps to be used for mail-merge purposes etc. Iterating
through the TClientdataset (and it really is a client data set) and
putting markers on a map based upon the calculated field is all well
and good, but filtering to create an export file using a filter
naturally doesn't work because you cannot filter on a calculated
field.

So the question is - how to create any form of data set that is the
result of a filter based upon a calculated field? I have shied away
from using the OnFilter record because the filter definition can be
quite complex and there are lots of records to filter - hence it
would be slow. But is this the only way we can get a filter based
upon a calculated field still?

Many thanks in anticipation of your help and with kind regards

David

Have a look at internal calculated fields.

Additionally, when the filter is needed for exporting only, you might
also be fine with looping and an if-condition-then-export, instead of
filtering.

hth Bernd

--

Technically that is actually all a filter does. It doesn't create a subset up
front, it just looks at each record as you scroll through the data and see if it
should be returned or skip to the next/prev record depending on the direction
you are scrolling.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Bernd Maierhofer

Posts: 161
Registered: 9/27/99
Re: TClientDataSet and Filtering on a calculated field  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 27, 2017 11:39 PM   in response to: David Smith in response to: David Smith
David Smith wrote:

Hi all. I have a mapping application that takes client data from an
Oracle database and then shows it pictorially over a map of the UK
using tmsSoftware's component and this works well. It shows a heat
map type display around the various company offices.

For this I use a calculated field using the OnCalc event to generate
the distance in miles from the office that services that client to
the client's home address. I also have a calculated field that - as
the name implies - calculates the distance from the client's home
address to any specified postcode that our business wants to put on
an 'event' at. Again this works well in that you can see what clients
live around, i.e. within a certain distance of, specified 'event'
postcodes.

However, I want to provide the facility to export the data to
spreadsheets - as all financial firms like their data in spreadsheet
form!! - perhaps to be used for mail-merge purposes etc. Iterating
through the TClientdataset (and it really is a client data set) and
putting markers on a map based upon the calculated field is all well
and good, but filtering to create an export file using a filter
naturally doesn't work because you cannot filter on a calculated
field.

So the question is - how to create any form of data set that is the
result of a filter based upon a calculated field? I have shied away
from using the OnFilter record because the filter definition can be
quite complex and there are lots of records to filter - hence it
would be slow. But is this the only way we can get a filter based
upon a calculated field still?

Many thanks in anticipation of your help and with kind regards

David

Have a look at internal calculated fields.

Additionally, when the filter is needed for exporting only, you might
also be fine with looping and an if-condition-then-export, instead of
filtering.

hth Bernd

--
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02