Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin Lingstuyl 202 posts 379 karma points
    Apr 15, 2014 @ 11:07
    Martin Lingstuyl
    0

    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:

    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.

    Martin

     

Please Sign in or register to post replies

Write your reply to:

Draft