*All records which are in Dublin we had contact with in the first quarter of 2014: ''Select count (intCDA_44_Id) as intTotal from CDA_44,CCL_44 Where intCCL_44_CDAId = intCDA_44_Id and strCDA_44_field_0_9 = 'Dublin' and dteCCL_44_EndDateTime >= '2014-01-01 00:00:00' and dteCCL_44_EndDateTime <= '2014-04-01 00:00:00' Group By intCDA_44_Id''
To save a lot of queries it is possible to use dynamic parameters as passed by the Tab, rather than the KeyStat.
e.g. In the Tab we put
--3[##SEP##]10--
in the KeyStat we put
*All records which are in Dublin we had contact with in the first quarter of 2014 which were last interacted with by staff X: ''Select count (intCDA_44_Id) as intTotal from CDA_44,CCL_44 Where intCCL_44_CDAId = intCDA_44_Id and strCDA_44_field_0_9 = 'Dublin' and dteCCL_44_EndDateTime >= '2014-01-01 00:00:00' and dteCCL_44_EndDateTime <= '2014-04-01 00:00:00' and intCDA_44_StaffId = --parameter0-- Group By intCDA_44_Id''
The number after the [##SEP##] is paramater 0 for as many parameters are as needed.