I have a situation in which I count the records for a particular form when that form gets visited (from within a workflow) If the number of records is above a certain number, the user gets redirected to another form. I use this for a training registration, in which overflow users are redirected to a waiting list form instead of entering the actual training registration.
The problem is that the following function is very slow when a lot of records are involved:
int nrOfRecords = store.GetAllRecords(e.Form.Id).Count();
So I created my own query to count the records:
SELECT COUNT(*) FROM UFRecords WHERE (Form = '{0}') AND ([State] = 4 OR [State] = 3)
This counts all submitted and approved Records. At least, I think it does. Some records have State '5'. These seem either to be deleted or double records.(?)
Can someone shed a light on the logic behind this State Column?
I have one 'allowed to edit' set to false, but still two sql-records seem to be bundled into 1 record in the entries viewer.
Counting Records by SQL Query
Hi Guys,
I have a situation in which I count the records for a particular form when that form gets visited (from within a workflow) If the number of records is above a certain number, the user gets redirected to another form. I use this for a training registration, in which overflow users are redirected to a waiting list form instead of entering the actual training registration.
The problem is that the following function is very slow when a lot of records are involved:
So I created my own query to count the records:
This counts all submitted and approved Records. At least, I think it does. Some records have State '5'. These seem either to be deleted or double records.(?)
Can someone shed a light on the logic behind this State Column?
I have one 'allowed to edit' set to false, but still two sql-records seem to be bundled into 1 record in the entries viewer.
Martin
is working on a reply...