Show/Hide Toolbars

When you have all the information you need to return search results, whether it is the search view key or the search criteria and parameters, you can execute the search.

The following code sample executes a search with search criteria and parameters. This sample returns search results for appointments in Room 101 sorted by start date.

public class AppointmentSample extends List<Appointment> {

 

@Override

public void action(Appointment appointment) {

}

 

public void searchAppointment() {

 

// Retrieve the appointment service from the platform provided by the API.

AppointmentService appointmentService = platform.getAppointmentService();

 

// Find all appointments located in Room 101

StringCriterion locationCriterion = new StringCriterion(new FieldPath(Appointment.LOCATION)).equalTo("Room 101");

SearchCriteria criteria = new SearchCriteria(locationCriterion);

 

// Sort results by start date

SearchParameters parameters = new SearchParameters(new SortField(new FieldPath(Appointment.START_ON)));

 

// Execute search

List<Appointment> results = appointmentService.search(criteria, parameters);

 

}

}