Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7554 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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.

Posted

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?

Posted

Whoops! I should have added a Halt Script step after Set Field [gUsername].

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.