Using Search Functions

This document explains how to use the different types of search functions in M3 Business Engine.

These types of search are available in M3 BE:

  • Simple search
  • Advanced search
  • Search including reserved words
  • M3 IES usage through API calls - Infor Enterprise Search (IES); Application Programming Interface (API)
  • Multi-level key search
  • Very advanced search queries
  • Lucene references

Simple search

This is the simplest form of searching and uses the entry of full words which are case sensitive. All columns are searched, and the words found may be from multiple columns.

  • Using the Search box

    In the Search box, specify the word to be searched for in full and in the correct case. For example, searching for 'cheese' returns all instances of 'cheese' in any column.

    Using AND with multiple words means that all the words must exist in one or more columns on a line. For example, searching for 'cheese' and 'juice' returns all lines where both words exist in any column on a line.

    Using OR with multiple words means that one of the words must exist in one of the columns. For example, searching for 'cheese OR juice' returns all lines where either word exists in one of the columns.

    Use ( ) to combine blocks of AND and OR. For example, 'cheese OR (juice 011215)' will return all lines where either 'cheese' exists or 'juice 011215' exists.

    You can use these wildcards in the Search box:

    • '*' - replaces more than one character. For example, 'chee*' returns all instances containing 'chee' such as 'cheese', 'cheeses', 'large cheeses', etc.
    • '?' - replaces a single character in a specific position. For example, 'jui?e' returns instances of 'juice'.
  • Columns

    To limit the search to a single column, right-click the column header and select 'Add to search'. Specify the search word.

  • Field names

    You can use field names in the search query to search in fields that are not displayed as a column. For example, 'chee* STAT:20' returns instances containing 'chee' and which also have the status of '20', even though the status is not displayed in a column.

  • Dates

    You can search for specific dates, using the same date format as defined for the user in the user master. For example, 'LMDT: 112515' returns all lines with '112515' in the date column in that format.

  • Decimal points

    The decimal point format used is controlled by the setting on the user master. For example, '.', ',' etc.

Advanced search

  • Ranges

    You can search for ranges of data by using brackets as follows:

    • [x TO y] means the values are included. For example, '[100 TO 480]' returns all instances in the selected column containing values from 100 to 480.
    • {x TO y} means the values are excluded. For example, '{100 TO 480}' returns all instances in the selected column outside the range 100 to 480.

    Ranges can use wildcards and combinations of '[' and '}' to find all transactions with a negative value.

  • Dates

    These date macros are provided:

    • YEAR(x)
    • MONTH(x)
    • WEEK(x)
    • DATE(x)

    'x' is a relative number with '0' being the current year, month, week, and date.

    For example, 'INDT:YEAR(-1)'.

    The DATE macro can be combined with ranges to create your own range. For example, 'LMDT:[DATE(-14) TO DATE(0)] returns all transactions within the last two weeks.

    When searching with NOT, this must be preceded by another query. For example, 'No:780 NOT INDT:YEAR(0)'.

    Date macros are very useful with saved searches as they give a quick link to, for example, last month's orders. They can be saved to Favorites, Canvas, as a menu option, or in the toolbox area, so they can be easily accessed.

  • Wildcards

    '?' - replaces a single character in a specific position and can be used together with other wildcards. For example, 'SUNO:?*'.

    For numeric fields you can use the NOT statement. For example nb mkll?>e, 'NOT STQT:0'.

    '~' – can be used in alphabetic characters, not numeric characters and is a fuzzy search. This means that the characters do not need to exactly match those in the query.

  • Sorting search results

    Sorting search results allows you to free sort any field in the main table of the function, apart from fields containing multiple words such as a description. A search finding results in a related table, set up in 'Related Search. Open' (CMS022) are not sorted.

    A search which finds results in both related tables and the main table presents hits for the main table first in the selected sorting method, followed by hits from the related tables which are not sorted.

    This sort is done by using the keyword 'SortBy:x,a,!y' where '!' performs a descending order.

    You can save sorting in the toolbox area which enables you to re-sort the list without having to use a separate index. For example, you could re-sort results for the current company number using 'CONO:xxx', where 'xxx' is replaced by the currently used M3 BE company number.

  • Searching multiple words

    Searching multiple words across several columns can easily return false results as it returns all instances of the search in all fields, in all columns. For example, 'chees* 10'.

    By using the keyword 'SearchFields:x;y;z', you can search in multiple columns but only in the specified fields. For example, 'SearchFields:ITDS,FUDS chees* 10'.

  • Key search

    Searching with the help of key search simplifies complex queries so they are easier to use. It also allows searching in other tables without the need for matching keys, as required by the related search setup in (CMS022).

    For example, you can define a query which, when specified, the preset part in the key search is automatically appended.

    Available key searches are displayed by using Ctrl+F.

    Note: A key search is performed on both the main table and related tables (defined in (CMS022) or related tables through 'Related Tables. Connect' (CMS011)).

Searching with reserved words

M3 IES (Infor Enterprise Search) Reserved Words are used in stored and published search queries to automatically retrieve information from the context they belong to.

By using reserved words, you can build and publish general widgets, favorite pages in M3 H5, and home pages and widgets in Infor OS.

Reserved words can also replace information in queries based on a selected line in a list, or from a panel header.

Saved search can also be used to add links to other programs where the search query is passed to the next program.

This table shows M3 IES (Infor Enterprise Search) reserved words:

Reserved word Effect
SortBy:x,y,!z Sorts search result in x, y, z hierarchy. The '!' prior to a field name performs a descending sort order.
SearchFields:x;y Limits search to listed fields x, y etc. Increases performance and can eliminate false hits.
Year(x) Date range of year relative to current year x=-1 means last year.
Month(x) Date range of month relative to current month x=-1 means last month.
Week(x) Date range of week relative to current week x=-1 means last week.
Date(x) Date range of date relative to current date x=-1 means previous day.
<xxxx> List & list header based replacements to query string.
<USID> Logged on user ID.
<CONO> Logged on company number.
<DIVI> Logged on Division; same as <CurrentDivision>.
<FACI> Default facility from 'User. Open' (MNS150).
<CUNO> Customer number from (MNS150).
<LNCD> Language code from (MNS150).
<CurrentLanguage> Currently used language in M3 BE (in case of switched language during session).
<TIZO> Time zone from (MNS150).
<WHLO> Warehouse from (MNS150).
<DEPT> Department from (MNS150).
<MNVR> Menu version from (MNS150).
<DFMN> Menu name from (MNS150).

This table shows M3 IES (Infor Enterprise Search) for use with key search only:

Reserved word Effect
<QRY> Specified query in the search string.
MAXJOIN:x Used to change the number of records used in the key search join (default set in IES local management pages).
NOOPT Used when multiple key searches are made in the same table. For example, 'find items with attribute x, y but NOT z' or 'items existing in warehouse a, b and c'.

Using stop words

M3 IES Stop Words are words that are not indexed and are automatically removed from the search query. For example, 'and', 'or, and 'etc'. IES, by default, has a set of English-based stop words which also include 'a', 'by', 'is', and 'as'. There may be cases where these words have an alternate meaning which does need to be included in a search. For example, 'Factor a' or the Swedish word 'is' which means 'ice' in English.

The workaround for this is to add a new stop word in the IED administration pages for those words. This would be called something unique that would not be searched for otherwise, such as 'lkdshja7789'.

Note: The affected tables such as MITMAS, MITLAD, OCUSMA, CIDMAS etc., must be re-indexed after adding new stop words in the IED administration pages.

Search query and key search rules

These rules are used to set '*' and '~':

  • <QRY>* - Automatically appends a wild card to each word in the specified query. For example, the query 'joh smit' is set to 'joh* smit*' before the search is performed.
  • <QRY>~' - Automatically appends a tilde, or fuzzy search, to each word in the specified query. For example, the query 'joh smit' is set to 'joh~ smit~' before the search is performed. Fuzzy searches should not be used with numeric values due to the nature of this type of search.

Exceptions:

  • Query inside "" - When specifying a query enclosed by double quotation marks "", wildcards are not added to the search as the search engine treats all characters contained within "" as normal characters. That is, "joh*" only returns results for 'joh*' including the '*' character, and not 'john' etc.
  • Short words - (With effect from M3 IES version 11 patch 5 onwards). Short words containing fewer than the number of characters set in the IES local administration page are not appended with '*' or '~'. For example, if the setting is three characters, which is the default, then 'jo', '10' and 'xl' would not appended with '*' or '~'. This is to improve system performance.

M3 Infor Enterprise Search (IES) usage through Application Programming Interface (API) calls

M3 API fully supports the use of IES. Some standard API transactions are search enabled, such as 'Trans SearchItem' MMS200MI, where the normal filter input is replaced by a search query. The search through API supports all normal search queries, except the UI related ones such as Date macros and field value replacements, such as <WHLO>.

MDBREADMI and CMS100MI are fully search-enabled.

Note: There is no fixed upper limit of records that can be returned by a search in an API, but there is a practical limit caused by a timeout. Therefore, the number of records returned depends on the environment, but a reasonable maximum is around 3.000-6.000 records.

For more details, see the API Repository in 'MI Repository. Open' (MRS001), 'MI Transaction. Open' (MRS002), and 'MI Transaction Layout. Open' (MRS003).

Facet searches

A feature of the IES through API calls is facet search. These are basically a count of the number of records that match a certain value in a specific field, or aggregating the number of records into various groups.

M3 facets are retrieved through (FACETIM). The input to the API is the table name for which the facets are retrieved, and secondly by the search query for filtering the facets and their count. For example, results of a query might be grouped as 161 records with a purchase price of '0' and 1 record with a sales price of '20'.

The advantage of using facets is high performance regardless of the number of records, and the filter of the facets and their count is based on a search query. This provides endless possible drill arounds in the data.

Facets can also be used as on-line statistics and they have been added to many M3 tables, including transactional and statistical tables. For example, facets are used in the M3 Sales Manager homepage template.

Multi-level key search

Multi-level key search is used to search across multiple tables in parallel.

Note: You must always start a multi-level search with the search returning the least number of hits which is also the one where you use the specified query, for example, the MITMAS level.

Adding several key searches makes it possible to search descriptions for different languages as well as aliases, using the same query. Note that you connect key search to a higher level in the same way as if there was only a single key search.

Further advanced search queries

This section is targeted at advanced IES users wanting to run IES search queries through code. These are not created manually.

Key search without Ctrl+F UI/(CMS030)

Example of syntax used when defined in 'Key Search. Open' (CMS030):

related:[ITEM/WHS("WHLO:100"; ITEM GRP1("ITGR:1533"; ITEM_BROWS("chair")))]

  • Key search ID that exists in (CMS030) – 'ITEM/WHS', 'ITEM GRP1, and 'ITEM_BROWS'
  • Query per key search – 'WHLO:100', 'ITGR:1533', and 'chair'
    Note: It is important to ensure the correct number of ')' are used.

Key search without UI/(CMS030)

Example of syntax used when not defined in (CMS030): related:

[MITMAS(ITNO;"ITGR:fop*"; ITEM_BROWS("chair"))]

  • Tablename in M3 - 'MITMAS'
  • Output fields from key search (use ',' if searching multiple fields) – 'ITNO'
  • Query per key search – 'ITGR:fop' and 'chair'
  • Key search ID that exists in (CMS030) – 'ITEM_BROWS'

Example of syntax used when not defined in (CMS030) and alias not in 'Field Alias. Open' (CMS031):

related:[ITEM_RESP("magnus";MITBAL(RESP=USID,CHID;"RESP:itama0";ITEM/WHS("WHLO:100";ITEM GRP2("1533";ITEM_BROWS("chair")))))]

  • Tablename in M3 – 'MITBAL'
  • Output fields from key search (use ',' if searching multiple fields) – 'USID','CHID'
  • Key search ID that exists in (CMS030) – 'ITEM_RESP', 'ITEM/WHS' and 'ITEM_BROWS'
  • Field alias (normally defined in (CMS031)) – 'RESP'

Example using key search

  • related:[ORDEREDGTO_1(MITMAS(ITNO;"ITNO:cherry OR ITDS:cherry~ OR FUDS:cherry~ OR ITDS:cherry* OR FUDS:cherry*"))]
  • related:[MITMAS(ITNO;"ITGR:fop*"; ITEM_BROWS("chair"))]
  • related:[ITEM/WHS("WHLO:100"; ITEM GRP1("ITGR:1533"; ITEM_BROWS("chair")))]
  • related:[MITBAL(ITNO;"RESP:itama0";ITEM/WHS("WHLO:100";ITEM GRP2("1533";ITEM_BROWS("chair"))))]
  • related:[MITMAS(ITNO;"ITGR:fop*"; ITEM_BROWS("chair"))] NOT related:[ITEM/WHS("WHLO:100] Separate key search. You can use AND (default if nothing specified), OR and NOT. In this example, hits that exist in the first part are listed as long as they do not hit in the second key search.
  • MAXJOIN:2000 related:[MITMAS(ITNO;"ITGR:fop*"; ITEM_BROWS("chair"))] Note that MAXJOIN increases the number of hits internally in the key search. This overrides the setting in the IES local management pages.

Lucene references

IES uses the Lucene search engine as a base. Lucene search syntax is documented in https://lucene.apache.org/core/2_9_4/queryparsersyntax.html.