Welcome, Guest
Guest Settings
Help

Thread: I'm missing something..



Permlink Replies: 4 - Last Post: Mar 20, 2017 8:01 AM Last Post By: Ian Branch Threads: [ Previous | Next ]
Ian Branch

Posts: 276
Registered: 9/23/99
I'm missing something..
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 19, 2017 4:25 PM
Hi Team,

Master detail tables. Detail linked via Datsource. Standard configuration.
How do I find out how many records there are in the detail? Normally 0 to 5.
RecCount keeps giving me total records.
What am I missing please?

Regards & TIA,
Ian
Peter Below

Posts: 1,065
Registered: 12/16/99
Re: I'm missing something..
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2017 12:38 AM   in response to: Ian Branch in response to: Ian Branch
Ian Branch wrote:

Hi Team,

Master detail tables. Detail linked via Datsource. Standard
configuration. How do I find out how many records there are in the
detail? Normally 0 to 5. RecCount keeps giving me total records.
What am I missing please?

Regards & TIA,
Ian

Depending on the database you are accessing the client table or query
objects may not even know how many records the detail query will return
until the detail dataset has been scrolled to the end.

To get a count of records one usually uses a SQL query like

select count(*) from detailtable where foreignkey =
<mastertable.primarykey>

The term in angle brackets needs to be either a literal value of the
master key, or a bind variable that is linked to the master dataset
key. I cannot give you details, sorry, since I never used this kind of
design in my applications.

--
Peter Below
TeamB

Ian Branch

Posts: 276
Registered: 9/23/99
Re: I'm missing something..
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2017 1:32 AM   in response to: Peter Below in response to: Peter Below
Hi Peter,
Thank you for your input.
I am using TTables rather than TQuerys.
I have worked out the following..

RecordCount := dsDetails.DataSet.RecCount;

This gives me exactly what I needed.

Regards,
Ian
Bernd Maierhofer

Posts: 101
Registered: 9/27/99
Re: I'm missing something..
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2017 2:52 AM   in response to: Ian Branch in response to: Ian Branch
Ian Branch wrote:

Hi Peter,
Thank you for your input.
I am using TTables rather than TQuerys.
I have worked out the following..

RecordCount := dsDetails.DataSet.RecCount;

This gives me exactly what I needed.

Regards,
Ian

But be aware, that this does what Peter has said: it scrolls to the end
to get the count, this can be time consuming.

HTH Bernd

--
Ian Branch

Posts: 276
Registered: 9/23/99
Re: I'm missing something..
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2017 8:01 AM   in response to: Bernd Maierhofer in response to: Bernd Maierhofer
HI Bernd,
Noted, however this is not a time critical action in this case.

Regards,
Ian
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02