Jump to content

Find Next Empty Field


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

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 6511 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
 Share

×
×
  • Create New...

Important Information

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