Add Set Command

Sets are often the result of a query. For more information, see Evaluate Query.

This page discusses:

Syntax

To improve performance, it is recommended that you use a list of object IDs or physicalIDs when you add a new set or modify a set to add new objects, instead of using a list of TNR. The kernel is lenient towards inclusion of invalid or non-existent IDs in the list when adding or modifying sets. The objects when not present or incorrect are not included in the set and there are no errors for invalid or non-existent IDs during the operation.

For example, the following code works without any errors and the set is created or modified, but without any new objects added to it:

add set set_1 member businessobject 00000000000000000000000000000000,11111111111111111111111111111111;

mod set set_1 add businessobject 00000000000000000000000000000000,11111111111111111111111111111111;

Use the following command to show any valid objects:

print set set_1

To manually define a set from within MQL, use the add set command:

add set NAME [user USER_NAME][ADD_ITEM {ADD_ITEM}];

  • NAME is the name of the set you are defining.
  • USER_NAME can be included with the user keyword if you are a business administrator with person access defining a set for another user. If not specified, the set is part of the current user’s workspace.

    All sets must have a unique name assigned within a given context. If you duplicate a name, an error message is displayed. Although a single user cannot duplicate a set name, different users can use the same name. Sets are local to the context of individual users. This means that several users could each have a set called “Current Project.” However, as you change context from one user to another, the contents of “Current Project” will most likely vary. For more information, see About Administrative Object Names.

  • ADD_ITEM is an Add Set clause that provides more information about the set you are defining. None of the clauses are required. The Add Set clauses are:
    member businessobject OBJECTID [in VAULT]
    member businessobject ID SEARCH_CRITERIA
    SEARCH_CRITERIA
    [!|not]hidden
    visible USER_NAME{,USER_NAME}
    property NAME [to ADMINTYPE NAME] [value STRING]
    • OBJECTID is the OID or Type Name Revision of the business object.

Member Clause

After assigning a set name, specify the business objects to include in the set. Business objects can be referenced by their complete business object name/specification or by their ID:

member businessobject TYPE NAME REVISION [in VAULT]

Or:

member businessobject ID

When using the complete specification, you must include the object type, the name of the object, and the revision designator in this order. Some business objects might not have a revision designator. If a revision designator was not assigned to an object, “” (double quotes) are required in MQL.

The following are examples of complete business object names:

businessobject Assembly "Keyboard" ""
businessobject Assembly Monitor E
businessobject Assembly "Laptop Computer" AA

To group these business objects into a set, you can write a command similar to the following:

add set "Computer Set"
   member businessobject Assembly "Keyboard" ""
   member businessobject Assembly Monitor E
   member businessobject Assembly "Laptop Computer" AA;

When this command is processed, a set called “Computer Set” is created. It contains three business objects. These objects will appear grouped in a window whenever the set name is referenced.

You can also optionally specify the vault in which the business object is held. When the vault is specified, only the named vault needs to be checked to locate the business object. This option can improve performance for very large databases.

When business objects are created they are given an internal ID. As an alternative to TYPE NAME REVISION, you can use this ID when indicating the business object to be acted upon. The ID of an object can be obtained by the use of the print businessobject selectable command. For more information, see Print Business Object Print Business Object for information.

Search Criteria

SEARCHCRITERIA can be added to a set. This allows you to add sets, queries, temporary sets, temporary queries and expansions of business objects to sets. Any of these items can be used in combinations covering multiple levels of complexity using the binary operators and, or, and less. For more information, see SEARCHCRITERIA Clause.