How to use the MobileMMS API Search Endpoint

How to use the MobileMMS API Search Endpoint

How to use the MobileMMS API Search Endpoint


The search endpoint can be used to search a MobileMMS form with everything from a very simple query all the way to a very elaborate nested query.
The basics of the JSON to search various data types of a form include

            "fieldType": "MapFieldName",

            "field": "Latitude",

              "operator": ">",

            "value": 1


The "fieldType" can be any of the attributes listed below including SystemFieldName, FormFieldName, MapFieldName, or MetadataFieldName.
The "field" is the name of the attribute you are trying to search within the "fieldType" specified.
The "operator" is used to determine what to search for, see the operators list below and the notes on what operators can be used for the various attribute types.
The "value" is of course the value you are trying to search for.

Examples of various types of search are listed below.

Field Types
The following are the valid Field Types and the corresponding type that the Value must be:

"SystemFieldName"
The Field must be a case-insensitive System Field Name:
  1. "Id": integer
  2. "ParentId": integer
  3. "AttachedToId": integer

"FormFieldName" (this is the default if the Field Type is left blank)
The Field must be a case-sensitive Form Field Name. The type for the Value depends on the type of the Form Field:
  1. CheckBox: boolean (the strings "Yes" and "No" are also allowed)
  2. AutoIncrement: integer
  3. Date: DateTime as a string
  4. Numeric: decimal
  5. All others: string
"MapFieldName"
The Field must be a case-insensitive Map Field Name:
  1. "Latitude": decimal
  2. "Longitude": decimal
  3. "DisplayMapMarker": boolean
  4. "FeatureClassAttachmentLinkId": integer
  5. "FeatureId": string
"MetadataFieldName"
The Field must be a case-insensitive Metadata Field Name:
  1. "CreatedDate": DateTime as a string
  2. "CreatedBy": string
  3. "LastModifiedDate": DateTime as a string
  4. "LastModifiedBy": string
  5. "ArchivedDate": DateTime as a string
  6. "ArchivedBy": string


Valid Operators

"="

equals

If the Value is null, "=" is equivalent to "isnull"

"!=" or "<>"

not equals

If the Value is null, "!=" (or "<>") is equivalent to "isnotnull"

"isnull"

is null

For "isnull" the Value is ignored. 

"isnotnull"

is not null

For "isnotnull", the Value is ignored.

">"

greater than

Only valid for non-strings

"<"

less than

Only valid for non-strings

">="

greater than or equals to

Only valid for non-strings

"<="

less than or equals to

Only valid for non-strings

"startswith"

starts with

Only valid for strings

"endswith"

ends with

Only valid for strings

"contains"

contains

Only valid for strings

"doesnotcontain"

does not contain

Only valid for strings

"=" and "!=" (or "<>") are the only valid operators for booleans.

 

Filter Examples

Single filter, "Latitude > 1":

"filter": {

    "filters": [

        {

            "fieldType": "MapFieldName",           

            "field": "Latitude",           

            "operator": ">",

             "value": 1

        }

    ]

}


Two filters combined with an "and" (the default "logic"), "Latitude > 1 and Latitude < 10":

"filter": {

    "logic": "and",

    "filters": [

        {

            "field": "Latitude",

            "fieldType": "MapFieldName",

            "operator": ">",

            "value": 1

        },

        {

            "field": "Latitude",

            "fieldType": "MapFieldName",

            "operator": "<",

            "value": 10

        }

    ]

}



Four filters with a nested "or", "Latitude > 1 and Latitude < 10 and (Longitude > 1 or Longitude < 10)":

"filter": {

    "logic": "and",

    "filters": [

        {

            "field": "Latitude",

            "fieldType": "MapFieldName",

            "operator": ">",

            "value": 1

        },

        {

            "field": "Latitude",

            "fieldType": "MapFieldName",

            "operator": "<",

            "value": 10

        },

        {

            "logic": "or",

            "filters": [

                {

                    "field": "Longitude",

                    "fieldType": "MapFieldName",

                    "operator": ">",

                    "value": 1

                },

                {

                    "field": "Longitude",

                    "fieldType": "MapFieldName",

                    "operator": "<",

                    "value": 10

                }

            ]

    ]

}

Sort Examples


Sort by Latitude ascending:

"sort": [

    {

        "field": "Latitude",

        "fieldType": "MapFieldName",

        "dir": "asc"

    }

]

Sort by Latitude ascending, then by Longitude descending:

"sort": [

    {

        "field": "Latitude",

        "fieldType": "MapFieldName",

        "dir": "asc"

    },

    {

        "field": "Longitude",

        "fieldType": "MapFieldName",

        "dir": "desc"

    }

]

Field and Field Type work the same way that they do for the Filter. Dir must be either "asc" (the default) or "desc", case-insensitive.


    • Related Articles

    • Using PowerBI with MobileMMS Rest API

      In order to analyze MobileMMS Data in Microsoft PowerBI, you must add data source using the following procedure: In order to connect to the MobileMMS API in Microsoft PowerBI using the Get Data From Web option, you must first create an API key within ...
    • How to use Low Data Mode to delay uploading photos in MobileMMS

      If you are using MobileMMS with a connected device like a tablet or laptop but your connection speeds are slow, you can use our Low Data Mode option to delay uploading of the pictures or attachments you may be taking while creating or editing ...
    • Crystal Reports

      Building Crystal Reports in MobileMMS One of many ways of summarizing and displaying information in MobileMMS is to build Crystal Reports.  Crystal Reports have the advantage of allowing the designer to format and summarize the data to a desired ...
    • How to Print a record with a basic layout.

      Any user can print the basic layout of a record by using the print below.  Once selected, a new tab displaying the record with the basic layout will be shown and the the user can then use the browsers print function to print the record to the desired ...