This topic is locked

Accessing Details count from List Page - Before Record Processed

11/25/2020 2:23:22 PM
PHPRunner General questions
B
bgohio_GIS author

I have a master-detail relationship and I would like to retrieve the count of how many related detail records are to the master from the list page - before processed event.
My end result is to hide rows that contain a certain number of detail records. I can access the count via $record on the After record processed page but is there any other way without having to utilize CURL(it is a rest service so DAL is not an option). I want to avoid making requests via CURL as it will slow my application down considerably.

A
acpan 11/25/2020

>>My end result is to hide rows that contain a certain number of detail records.
Not sure about the first part, but if you want to achieve the end result, maybe just modify your master table SQL Query (and maintain your master-child relation) as follows:
select

from master_table as t1

where

(select count(
) from detail_table as t2 where t2.id_group = t1.id) < 3 ;
With that, only records in master table with the detail rows less than 3 will be returned in your list.
Try the demo.

B
bgohio_GIS author 11/30/2020



>>My end result is to hide rows that contain a certain number of detail records.
Not sure about the first part, but if you want to achieve the end result, maybe just modify your master table SQL Query (and maintain your master-child relation) as follows:
select

from master_table as t1

where

(select count(
) from detail_table as t2 where t2.id_group = t1.id) < 3 ;
With that, only records in master table with the detail rows less than 3 will be returned in your list.
Try the demo.


I wish I could do this but I'm using a rest service which I can't use sql.