xpxSelectInstancesBNEx
FUNCTION xpxSelectInstancesBNEX (modelId : GENERIC; modelVersion : INTEGER; entityName, condition : STRING; options : INTEGER; attributes : STRING; include_exclude_filter : AGGREGATE OF GENERIC; orderBy : STRING; firstIndex, maxHits : INTEGER; xmlConfigurationName : STRING; resultFileName : STRING; VAR indexOfLastFound : INTEGER; VAR actualHits : INTEGER; VAR queryResultIndex : INTEGER; VAR resultString : STRING); status : INTEGER;
The xpxSelectInstancesBNEx function search in the specified remote edmModel for instances of a specified type that match a given condition. Optionally subtypes of the specified type may be included in the search. The condition may be any legal symbolic Express-X logical expression. An undefined or empty string condition will match all instances of the specified types. All the instance Ids of the candidates are collected in a single temporary instance aggregate. This aggregate will be searched for matching instances. The index of the first aggregate element to check, and the maximum number of matching instances to return, are specified as input arguments to the function. The actual number of matching instances returned and the index of the last returned matching instance in the instance aggregate will be returned from the function. This makes it possible to query through huge amounts of instances by means of a loop where each iteration handles a small subset of the total instance aggregate. The <condition> argument will be compiled by the EDMexpressXCompiler. The specified query will be executed by the EDMexpressVM. The <attributes> argument may contain a "dot expression" including Express built-in functions and EDMexpressX xpf bult-in functions. Attributes argument SYNTAX example:
"Name sizeof(sdai_model.underlying_schema.entities)"
This example is from an edmiRemoteSelectInstances operation on the EDM_MODEL objects in the SystemRepository.ExpressDataManager model. There will be 2 columns
- The Name attribute of the EDM_MODEL
- The number of entities in the "underlying schema" of the model.
The column names in the resulting "query table" will be "name" and "sizeof(sdai_model.underlying_schema.entities)" respectively. By using the "->" characters, a new column name can be specified. Example: if we want the 2nd column to be given the name "entities", we may write the 2nd attribute like this:
"sizeof(sdai_model.underlying_schema.entities)->Entities"
Note that the characters white space, comma, and semicolon are all used as delimiters between the attribute "names" in the attributes argument, hence none of these characters can be used in the attribute name/attribute expression. The total number of hits will be returned in the <actualHits> argument.
Arguments
Type | Name | Comment |
GENERIC | modelId | A numeric modelID that uniquely identifies the data model of interest in the EDMdatabase . |
INTEGER | modelVersion | The numeric version ID that specifies the version of the model to select instances from. If unset, the version will be the latest version. |
STRING | entityName | Specifies the name of the entity that defines the actual instance type to query. Entity names are case insensitive. |
STRING | condition | The condition that the instances in the instance aggregate shall match. An undefined or empty string condition will match all the instances of the specified type.
|
INTEGER | options | Specifies the options to be used in the invocation of the xpxSelectInstancesBNEx function. The <condition> value can be specified as a bitwise OR between the actual options to enable. See the description of available options below. |
STRING | attributes | Specification of the title and contents of each column of the returned query result table. The following examples illustrate the SYNTAX.
|
AGGREGATE OF GENERIC | include_exclude_filter | The numeric id of an aggregate containing the names or ids of the entities that will be affected by this filter. If the option [xpxFILTER_AS_ENTITY_IDS] is used, this parameter will be interpreted as an aggregate of instance ids, each defining an entity. If the option [xpxFILTER_AS_ENTITY_NAMES] is used, this parameter will be interpreted as an aggregate containing entity names. If the option [xpxINCLUDE_FILTER] is used, no instances but those of a type contained in the aggregate will be included. If the option [xpxEXCLUDE_FILTER] is used, all instances but those of a type contained in the aggregate will be included. |
STRING | orderBy | Name of the query result column to use for sorting. The column may be specified with its constructor or by the column title. |
INTEGER | firstIndex | All the instances of entities are kept in entity extents. All the entity extents of the entities that are to be queried (subtypes may also be queried) are joined into a single aggregate of instances. The position in this aggregate to start reading from is specified by this parameter. This way, huge populations may be incrementally queried by setting this argument equal to one more than the value of <indexOfLastFound> that resulted from the previous iterative call to this function. |
INTEGER | maxHits | The greatest allowed number of hits in the query result. When this number of matching instances is found, the search for additional matches will stop. |
STRING | xmlConfigurationName | The name of the XML configuration to apply to the resulting XML formatted query result when the option [xpxXML_FORMAT] is used. |
STRING | resultFileName | The name of the file that will contain the returned XML, HTML or ASCII formatted query result. Only applicable when using the [xpxRESULT_IN_FILE] option in combination with one of the options [xpxHTML_FORMAT], [xpxASCII_FORMAT] or [xpxXML_FORMAT]. |
INTEGER | indexOfLastFound | The index of the "last returned matching element". This argument enables the caller to search for instances in an incremental way by specifying this returned "index value plus one" as the input to the next xpxSelectAggrInstancesEx function and so on. |
INTEGER | actualHits | The number of matching instances found. If this value is equal to the <maxHits> argument, it is a possibility that there may be more matching instances among the queried entity types. |
INTEGER | queryResultIndex | A numeric index that identifies the generated query result within internal data structures in EDM. Use the <queryResultIndex> as input to the function xpfGetQueryResultDataCell to access the actual data within the query result. is used to specify the actual EDMinstanceHashTable. queryResultIndex = 0 : the resulting instances will be inserted in a new EDMinstanceHashTable. queryResultIndex != 0: Specifies an actual existing EDMinstanceHashTable, i.e., the resulting instances will be inserted (added) to the specified EDMinstanceHashTable
On return: queryResultIndex : The actual EDMinstanceHashTable index that holds the resulting instances. |
STRING | resultString | Variable that will receive the returned XML, HTML or ASCII formatted query result when the option [xpxRESULT_IN_STRING] is used with one of the options [xpxHTML_FORMAT], [xpxASCII_FORMAT] or [xpxXML_FORMAT]. |
Return Value
Options
Option | Comment |
xpxSUBTYPES | Search for matching instances of the entity specified by the <entityName> argument and all instances of any of its subtypes. |
xpxALL_ATTRIBUTES | When the argument <attributes> is undefined or an empty string, all attributes of the instances will be included in the query result. However, if the <attributes> argument is used to add one or more additional constructed columns or to rename a column in the query result, the return of all the instance attributes will be hindered due to an <attributes> argument that is no longer undefined or an empty string. Use this option to force the including of all instance attributes even when the <attributes> argument is not undefined or an empty string. |
xpxINCLUDE_CONFIGURATION | Includes the XML Configuration in the generated ISO10303-28 compliant XML formatted query result. This option has no effect unless combined with the option [xpxXML_FORMAT]. |
xpxINCLUDE_SCHEMA | Includes the underlying meta data in the generated ISO10303-28 compliant XML formatted query result. This option has no effect unless combined with the option [xpxXML_FORMAT]. |
xpxRESULT_IN_STRING | The resulting table will be returned in a string allocated in heap-memory of the calling application. Use the option [xpxRESULT_IN_FILE] to write the table to a file. |
xpxEXTRACT_SHALLOW | Use this option to force a shallow XML formatted query result. ISO10303-28 compliant XML Query results are deep by default. No other query result format supported by this function is deep. Hence, this option has no effect unless combined with the option [xpxXML_FORMAT]. |
xpxTRANSFER_NO_DATA | No query result will be returned from the remote EDMdatabase. Use this option when the number of matching instances is the only information needed or for testing the query SYNTAX before actually performing it. |
xpxASCENDING | Arrange the query result instances in ascending order. This option is only applicable when the <orderBy> argument is used. |
xpxDESCENDING | Arrange the query result instances in descending order. This option is only applicable when the <orderBy> argument is used. |
xpxONLY_INSTANCE_IDS | Return only a single column with the instanceIds of the matching instances. |
xpxINCLUDE_INSTANCE_IDS | Prepend all attribute columns in the query result with an instanceId column |
xpxINCLUDE_FILTER | Only the subtypes of the entity given by the <entityName> argument that are listed in the <include_exclude_filter> argument will be queried for matching instances. Only applicable when combined with the [xpxSUBTYPES] option. |
xpxEXCLUDE_FILTER | All subtypes of the entity given by the <entityName> argument except those listed in the <include_exclude_filter> argument will be queried for matching instances. Only applicable when combined with the [xpxSUBTYPES] option. |
xpxRESULT_IN_FILE | The resulting table will be written to a file on the local file system of the calling application. The name of the file must be specified in the <resultFileName> argument. |
xpxEDM_IDENTIFIERS | The instanceIds that uniquely identify the instances in the remote EDMdatabase will be used as xmlIds for identification of the instances within the ISO10303-28 compliant XML formatted query result. |
xpxFILTER_AS_ENTITY_NAMES | The <include_exclude_filter> argument will be interpreted as an aggregate of strings. Each string must give the name of a subtype of the entity given by the argument <entityName>. This option is only applicable when combined with the [xpxSUBTYPES] option. |
xpxFILTER_AS_ENTITY_IDS | The <include_exclude_filter> argument will be interpreted as an aggregate of entityIds. Each entityId must identify a subtype of the entity given by the argument <entityName>. This option is only applicable when combined with the [xpxSUBTYPES] option. |
xpxHTML_FORMAT | The query result table will be presented in HTML format in a locally allocated string or in a file on the local file system. See the options [xpxRESULT_IN_FILE] and [xpxRESULT_IN_STRING]. |
xpxASCII_FORMAT | The query result table will be presented in plain ASCII format in a locally allocated string or in a file on the local file system. See the options [xpxRESULT_IN_FILE] and [xpxRESULT_IN_STRING]. |
xpxOLD_XML_FORMAT | The result of the query will be returned in a simple well formed XML formatted file on the local file system. |
xpxXML_FORMAT | The result of the query will be returned in an ISO10303-28 compliant XML formatted string or in a file on the local file system. |
xpxZIPPED_FILE | The file given by the argument <resultFileName> will be compressed . This option has no effect unless combined with the option [xpxRESULT_IN_FILE]. |
xpxIGNORE_EMPTY_COLUMNS | Columns for attributes that do not have defined values for any of the returned instances will be left out of the query result table. |
xpxRESULT_IN_INSTANCE_HASH_TABLE | insert the resulting instances in an EDMinstanceHashTable |
Example
<Missing Example>
See also
Filter by label
There are no items with the selected labels at this time.