Greg M Posted March 17, 2004 Posted March 17, 2004 I am trying to create an activity signup database. Each event will be a record, and there is a repeating field called Attendees. There is a field called Capacity that defines the maximum amount of participants. There is also a global field called Username that, through VBScript, contains their logon username. I want the users to be able to click a button and have the script find the next empty row and insert their username, but not allow them to sign up if the number of repetitions in the Assignees field exceeds Capacity. Version: v6.x Platform: Windows 2000
-Queue- Posted March 17, 2004 Posted March 17, 2004 If [Count(Attendees) = num of repetitions in Attendees] [color:"white"]__Show Message ["You cannot add any more participants"] [color:"white"]__Halt Script End If Go to Field [Attendees] Loop [color:"white"]__If [isEmpty(Status(CurrentFieldContents))] [color:"white"]____If [status(CurrentRepetitionNumber) > Capacity] [color:"white"]______Show Message ["The maximum number of participants has been assigned."] [color:"white"]______Halt Script [color:"white"]____End If [color:"white"]____Set Field [gUsername] [color:"white"]__End If [color:"white"]__Go to Next Field End Loop I haven't tested this, but I think it should work. Just make sure you don't Specify a field for the Set Field step and make sure all repetitions of Attendees are consecutive in the Tab order.
Greg M Posted March 22, 2004 Author Posted March 22, 2004 It works - kind of. Because of the Go to Next Field step and the Loop, it fills every open slot. How can I get it to enter the username only once?
-Queue- Posted March 22, 2004 Posted March 22, 2004 Whoops! I should have added a Halt Script step after Set Field [gUsername].
Greg M Posted March 22, 2004 Author Posted March 22, 2004 Suppose I want to allow people to un-sign up. How could I have it remove a repetition from Attendees based on gUsername?
-Queue- Posted March 23, 2004 Posted March 23, 2004 Freeze Window Go to Field [Attendees] Loop [color:"white"]__ If [gUsername = Status(CurrentFieldContents)] [color:"white"]____ Set Field [""] [color:"white"]____ Exit Record/Request [color:"white"]____ Halt Script [color:"white"]__ End If [color:"white"]__ Go to Next Field [color:"white"]__ Exit Loop If [status(CurrentFieldName) <> "Attendees"] End Loop Exit Record/Request As long as there is more than just the Attendees field on the layout, this won't loop infinitely. A note about the first script: to make it nicer for your users I would add a Freeze Window step to the beginning and Exit Record/Request steps just before the Halt Script steps. Version: v5.x Platform: Windows 2000
Recommended Posts
This topic is 7554 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now