March 17, 200421 yr 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
March 17, 200421 yr 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.
March 22, 200421 yr Author 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?
March 22, 200421 yr Author Suppose I want to allow people to un-sign up. How could I have it remove a repetition from Attendees based on gUsername?
March 23, 200421 yr 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
Create an account or sign in to comment