AnsweredAssumed Answered

Using ExecuteSQL to count records in Table

Question asked by ndveitch on Mar 15, 2016
Latest reply on Mar 15, 2016 by ndveitch

Hi there,

 

I was wondering, I need to count a certain amount of records based on various fields and normally I would end up making a few global fields, then a TO to link the tables and then work out my count value that way. I am trying to get my head around ExecuteSQL() as I believe it could be the answer.

 

I have a table with Static Activities and File Activities. When a job is created, the system copies all the Static records into the File Activities table and marks them as locked. Senior management may modify these records if need be, depending on the job. Then the File Activities are displayed on the Job layout in a portal with the static records at the top and then below the user gets to add any new activities should any arise.

 

Now I have to make sure that at least 2 new activities are added to the File Activity portal before the user can leave the layout. I was thinking of creating a count field in the File Activities Table and then count the records where the Job number equals and the records are not locked. Then as long as the count is over 2, the user can proceed to the next section. Im not keen on creating more TO's but will if I have to, as my DB needs a major clean up because I started this program when I first started using FileMaker, so as you can guess, there are already way to many TO's and some that were added and never really used.

 

I was hoping to be able to use the ExecuteSQL(count) to count the records, but i am unsure of how to do it.

Outcomes