Hi,
I've been racking my brain trying to figure out how to count the number of child records for a specified parent record with out having to apply a filter.
In a simplified scenario, I've Table A (parent) and Parent B (child) that make up a set, with a One to Many relationship for Table A to Table B. When viewed in a form, I've one parent record displayed in text, with many child records displayed in an embedded browse.
Through some sort of script I want to be able to count the number of child records displayed in that embedded browse with out having to run a filter query, (trying to utilise the set). If the records are right there in front of me, you should be able to count them right?
I'm trying avoid a filter so I can maintain a speedy database. Two methods I've already tried so far are
1) attach a pointer to the current set "set".current, which I was hoping would restrict the data to what is currently being viewed. I then open a table pointer on table B, using
table_pointer = set_pointer.TableB , from which I then tried both Fetching through the records and the Table.Records_get() function. The count was not succesfully restricted to the particular records of the parent record.
2) I tried to count the records that were attached to the form object.
rec_num = topparent:browse1.Records_Get()
The script counted all the records that were available to the form instead of the records currently displayed in the browse.
Is there no way to count the records in the embedded browse that are displayed right there in front of me?
I've been racking my brain trying to figure out how to count the number of child records for a specified parent record with out having to apply a filter.
In a simplified scenario, I've Table A (parent) and Parent B (child) that make up a set, with a One to Many relationship for Table A to Table B. When viewed in a form, I've one parent record displayed in text, with many child records displayed in an embedded browse.
Through some sort of script I want to be able to count the number of child records displayed in that embedded browse with out having to run a filter query, (trying to utilise the set). If the records are right there in front of me, you should be able to count them right?
I'm trying avoid a filter so I can maintain a speedy database. Two methods I've already tried so far are
1) attach a pointer to the current set "set".current, which I was hoping would restrict the data to what is currently being viewed. I then open a table pointer on table B, using
table_pointer = set_pointer.TableB , from which I then tried both Fetching through the records and the Table.Records_get() function. The count was not succesfully restricted to the particular records of the parent record.
2) I tried to count the records that were attached to the form object.
rec_num = topparent:browse1.Records_Get()
The script counted all the records that were available to the form instead of the records currently displayed in the browse.
Is there no way to count the records in the embedded browse that are displayed right there in front of me?
Comment