countObjects

Back to index

Summary

Retrieves the count of objects specified by the provided filter.
objectType
Stringrequired
The type of object to query for.
caseSensitiveSearch
Booleanoptional
Applicable only for case-sensitive databases. When set to True (default), searches are case-sensitive. When set to False, searches are case-insensitive.
filters
Array<Filter>optional
A list of zero or more filter criteria definitions used to define objects to find.
firstResult
Integeroptional
The first result to be retrieved, numbered from 0.
maxIds
Integeroptional
The maximum number of object IDs to return.
viewName
Stringoptional
The name of the view.

Usage

Groovy

import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.models.* ElectricFlow ef = new ElectricFlow() def result = ef.countObjects( objectType: "test-objectType" /* optional arguments */ )

Examples

Retrieve number of projects based on name

This example retrieves the number of projects whose name contains test.

import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.models.* ElectricFlow ef = new ElectricFlow() // Define filters for the query Filter projectFilter = new Filter('projectName', 'contains', 'test') // Execute the query with filters def result = ef.countObjects(objectType: "project", filters: [projectFilter])

Retrieve number of applications based on name and type

This example retrieves the number of applications whose name contains snapshot and are application type traditional.

import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.models.* ElectricFlow ef = new ElectricFlow() def filters = [] // Define filters for the query Filter applicationNameFilter = new Filter( propertyName: 'applicationName', operator: 'contains', operand1: 'snapshot' ) filters.add(applicationNameFilter) Filter applicationTypeFilter = new Filter( propertyName: 'applicationType', operator: 'equals', operand1: 'traditional' ) filters.add(applicationTypeFilter) // Execute the query with filters def result = ef.countObjects(objectType: "project", filters: filters)
You can find the property names, and their associated datatypes for any entity, using describeObject API.