Skip to content

Defined searches

Defined searches can be configured to each node. These searches can be used to restrict the search space. By default, all attributes of all searches can be searched. FormFields can be defined in the search attributes and will not be sent to the server.

To search the child nodes in insight-mobile, a searches configuration must be set.

At e.g. selectFromTree can also use an explicit search.This definition also reduces the size of the offline search model in mobile.

Index search, one search field

"query": {
    "constraint": "1 = 1",
    "searches": [
        {
            "name": "assetnum",
            "label": "Number",
            "attributes": [
                "ASSETNUM"
            ]
        },
        {
            "name": "all",
            "label": "All",
            "attributes": [
                "ASSETNUM",
                "DESCRIPTION",
                "SITEID"
            ]
        }
    ]
}

Backend search, attribute search fields

Searches can be executed on the eam database tables.

"query": {
    "constraint": "1 = 1",
    "searches": [
        {
            "name": "assetnum",
            "label": "Number",
            "attributes": [
                "ASSETNUM"
            ],
            "backend": true
        }
    ]
}

For maximo-backend it is possible to use inline-attributes as search criteria in root-nodes.

"query": {
    "constraint": "WO.HISTORYFLAG=0 AND WO.PARENT IS NULL AND WO.STATUS IN ('INPRG')",
    "searches": [
        {
            "name": "workorder",
            "label": "Workorder",
            "attributes": [
                "WOASSET/LOCATION"
            ],
            "backend": true
        }
    ]
}

Typically problems are that attributenames in the constraint could be ambigous. That means they occure in root and child-node. Errors like "sqlexception caught#Ambiguous column name 'STATUS' for MSSQL-Database can be solved by using the qualified names in query-constraint as in example above.

Index search, attribute search fields

Searches will be executed on search index using search fields for each attribute.

"query": {
    "constraint": "1 = 1",
    "searches": [
        {
            "name": "assetnum",
            "label": "Number",
            "attributes": [
                "ASSETNUM"
            ],
            "showFields": true
        }
    ]
}

Override attribute properties

Attributes can be configured as complex objects to override existing attributes properties. Select attributes with options or selectFromTree.

"query": {
    "constraint": "1 = 1",
    "searches": [
        {
            "name": "assetnum",
            "label": "Number",
            "attributes": [
                {
                    "name": "ASSETNUM",
                    "selectFromTree": null
                },
                {
                    "name": "COUNT",
                    "widget": "NativeDecimal"
                }
            ],
            "showFields": true
        }
    ]
}

Disable multi value

Select attributes with options or selectFromTree have got a multi value support by default. This feature can be deactivated by "multiValue" = false. This must be done to use the autoFill feature.

"query": {
    "constraint": "1 = 1",
    "searches": [
        {
            "name": "assetnum",
            "label": "Number",
            "attributes": [
                {
                    "name": "ASSETNUM",
                    "selectFromTree": {...},
                    "multiValue": false
                }
            ],
            "showFields": true
        }
    ]
}

Search operators

Attributes can be used with operators like: greater than, less than, like, equals, not equals. It is also possible to set two operators to archive a from to search. Then two input fields are generated, for example: ["gt", "lt"]. Can only be used with backend or showFields: true. Valid operators are:

  • gt: greater than
  • gte: greater than or equals
  • lt: less than
  • lte: less than or equals
  • eq: equals
  • notEquals: not equals
  • like: like
"query": {
    "constraint": "1 = 1",
    "searches": [
        {
            "name": "reportdate",
            "label": "Report date",
            "attributes": [
                {
                    "name": "REPORTDATE",
                    "search": {
                        "operators": [
                            "gte",
                            "lte"
                        ]
                    }
                }
            ],
            "backend": true
        }
    ]
}

Backend search with OR

You can search with one attribute across multiple attributes using OR. To do this, a formField attribute must be configured on the node, which can then be used in the search. This can be used with backend searches, online and offline. Additionally, this formField attribute can be used in a filter menu action and barcodeFilter menu action. At the attributes of the node config:

"attributes": [
    {
        "name": "ALL",
        "label": "WONUM/DESC",
        "formField": true,
        "type": "String",
        "control": "hidden",
        "search": {
            "or": [
                "WONUM",
                "DESCRIPTION"
            ]
        }
    }
]

At the query.searches of the node config:

"searches": [
    {
        "name": "search",
        "label": "Search",
        "attributes": [
            {
                "name": "ALL"
            }
        ],
        "backend": true
    }
]