Skip to main content

system.mes.location.findLocations

Description

Retrieves Locations records based on the specified pagination, sort, and column constraint parameters.

Syntax

system.mes.location.findLocations(**queryRequest)

Parameters

Using Python keyword arguments, a Query Request can be passed to the findLocations function without specifying each parameter individually. Please refer to the Query Request documentation for a list of parameters.

Returns

Returns a Query Result object with the following properties:

NameTypeDescription
contentList<Location>The list of all records found that meet the specified criteria
totalPagesIntegerIf pagination is used, this is the number of total pages of records in the database for the specified page size.
totalElementsLongIf pagination is used, this is the number of records in the database that meet the specified criteria.
pageSizeIntegerIf pagination is used, this is the specified page size.
pageIndexIntegerIf pagination is used, this is the specified page index.
hasContentBooleanTrue if any records were found that meet the specified criteria.
isFirstBooleanIf pagination is used, this is true if the first page was returned.
isLastBooleanIf pagination is used, this is true if the last page was returned.
hasNextBooleanIf pagination is used, this is true if there is a page of content available after this one.
hasPreviousBooleanIf pagination is used, this is true if there is a page of content available before this one.

Code Examples

Here is an example of how to use a Query Request to retrieve the first ten locations created in 2025 sorted by their name.

# Generate the object structure for a new query request
queryRequest = system.mes.query.newQueryRequest()

# Set the basic attributes of the query request
queryRequest['pageSize'] = 10
queryRequest['pageIndex'] = 0

queryRequest['sortFields'] = ['name']
queryRequest['sortDirection'] = 'Ascending'

# Generate the object structure for a filter for the query request
filterRequest = system.mes.query.newFilterRequest()
filterRequest['field'] = 'createdDate'
filterRequest['condition'] = 'between'
filterRequest['minDateValue'] = '2025-01-01T00:00:00Z'
filterRequest['maxDateValue'] = '2026-01-01T00:00:00Z'

filters = [filterRequest]

queryRequest['filters'] = filters

# Retrieve the locations that match the filter
result = system.mes.location.findLocations(**queryRequest)

# Output the locations that match the filter.
print(result)