This topic is locked
[SOLVED]

 Count Specific Records

6/2/2010 12:56:56 PM
ASPRunnerPro General questions
J
Jay123 author

Hi!
I'm using ASPRunner 6.1.
I would like to ask how to show the count of specific record of a certain field and block that selection after it reached the limit that I have set.
For example, Field_1 is a dropdown where the user needs to select car or truck.

I would like Field_2 to show the total number of car and truck that have been recorded on the database based from the previous users' selection.
Likewise, I want to set a stop. If 10 cars have been selected already, the next users should no longer be able to select car on Field_1.
Thanks,

Jay

A
ann 6/3/2010

Jay,
you can create an alias of the field on the Edit SQL tab. Proceed to the Choose fields tab to unheck alias on the List page. Then

use Before display event to hide fields on the view page everytime your if condition is satisfied:

http://www.asprunner.com/forums/topic/6201-how-to-hide-controls-on-addedit-pages/

J
Jay123 author 6/3/2010

Hi Ann,
Thanks for your reply.
Unfortunately, that solution wouldn't work on my situation. I've used that before in my other project and it worked well.
For this new one, the important thing for me is to show the count of selected item (car or truck).
If the first user selected car on Field_1, I want Field_2 to show "1" if the second user will select car on Field_1. If 5 users have selected truck already, I want Field_2 to show "5" if the next user will try to select truck on Field_1.
I hope I explained it very well.
Thanks,

Jay

A
ann 6/4/2010

Jay,
in general you can do it in the following way:

Create a view of the table in database to store count(cars) and count(truck) fields. Then define Field_2 as dropdown on the "Edit as settings"dialog on theVisual Editor tab and point it to this view. Use JavaScript Onload Event on the Events tab to check value of Field_2 and create some message to prevent saving.

Unfotunately, we don't have a ready to go solution fot this.

J
Jay123 author 6/4/2010

Hi Ann,
Thanks a lot for the idea. I figured it out and it worked!
Thanks,

Jay