Version

Loop through the Activities Collection on the Client Side

When working with the WebSchedule™ you may want to loop over the Activities available client-side. The code below shows how to loop over the Activities collection client-side and find an activity that’s Subject is New Appointment , and displays an alert box showing its Location .

In JavaScript:

function LoopOverActivitiesCollection()
{
	// Get a reference to the WebScheduleInfo
	var scheduleInfo = ig_getWebScheduleInfoById("WebScheduleInfo1");
	// Get the WebScheduleInfo's Activities
	var activities = scheduleInfo.getActivities();
	var activity = null;
	// Loop over the activities collection
	for(var i = 0; i < activities.length; i++)
	{
		// Find the activity that has subject New Appointment
		if(activities[i].getSubject() == "New Appointment")
		{
			activity = activities[i];
			// Return the New Appointments Location
			alert(activity.getLocation());
			break;
		}
	}
}