Query Definition: Attribute Substitution 
Attribute substitution is provided to facilitate the definition of complex queries and to enhance runtime usability. This section describes the supported attributes and their use.
Note
The spelling, capitalization and formatting of attributes must match the information provided here exactly or the attribute will not be substituted and the query will fail.
Attribute |
Description |
Usage |
|---|---|---|
<%CURRENT_USER_ID%> |
Object ID corresponding to the currently logged-in user at query execution. |
WHERE DOC_OWNER_USER_OBJECT_ID =<%CURRENT_USER_ID%> |
<%CURRENT_USER_NAME%> |
String name of the currently logged-in user at query execution. |
WHERE DOC_OWNER_USER_OBJECT_NAME =<%CURRENT_USER_NAME%> |
<%NOW%> |
Current date and time at query execution. |
WHERE CREATED_AT <= <%NOW%> |
<%TODAY%> |
Current date at query execution. |
WHERE FCI_DATETRUNC(CREATED_AT) = FCI_DATETRUNC(<%TODAY%>) |
<%CURRENT_USER_COMPANY%> |
Object ID of the company associated with the current logged-in user at the time of query execution. |
WHERE PURCHASER_COMP_OBJECT_ID =<%CURRENT_USER_COMPANY%> |
<%COMPANY_CURRENCY_OBJ_ID%> |
Object ID of the currency that is set for the company associated with the current logged-in user at the time of query execution. |
<%SCHEMA%>.FCI_DOC_CUR_CONVERT(ESTIMATED_PRICE,ESTIMATED_OBJECT_ID,<%COMPANY_CURRENCY_OBJ_ID%> |
<%CURRENT_USER_SUPPLIER%> |
Object ID of the supplier associated with the current logged-in user at the time of query execution.
The current user supplier is only defined for sell-side users. As a result, this attribute will not expand in the SQL Preview mode since the Query Definition object is only visible to buy-side users. End of the note. |
WHERE SUPPLIER_REF_OBJECT_ID =<%CURRENT_USER_SUPPLIER%> |
<%CURRENT_USER_ENTERPRISE%> |
Object ID of the enterprise associated with the current logged-in user at the time of query execution.
This attribute is applicable in very limited circumstances. Query results are generally filtered for the correct company or enterprise using the<%CONTEXT(name)%> End of the note. |
WHERE CONTEXTID =<%CURRENT_USER_ENTERPRISE%> |
<%CURRENT_USER_GROUPS%> |
Comma-separated list of Object IDs of groups where the currently logged-in user is a member. Frequently used in queries examining collaborator membership on documents. |
WHERE T2.USER_GROUP_OBJECT_ID IN(<%CURRENT_USER_GROUPS%>) |
<%USER_LOCALE_KEY%> |
String with language and country of current user, used as parameter to SQL function to find locale-specific string in stored procedure. |
FCI_GET_RESOURCE_VALUE( cterms$cterm.important.msg,<%USER_LOCALE_KEY%> |
<%CONTEXT(logicalName)%>
<%logicalName%> refers to the value in the Class ID column of the Class List table located in the Class Reference section of the online Reference Guide (RG). End of the note. |
Context of the currently logged–in user at the time of query execution. See the notes following the table for details. The case of logicalName must be correct. |
WHERE CONTEXTID =<%CONTEXT(projects.projects)%> |
<%SCHEMA%> |
Used to prefix the current Oracle schema identifier to any table names |
FROM<%SCHEMA%>.FCI_MAS_CURRENCY |
<%EXT_TABLE(logicalName)%><%EXT_TABLE(logicalName,CollectionName)%>
<logicalName> refers to the value in the Class ID column of the Class List table located in the Class Reference section of the online Reference Guide (RG). End of the note. |
Fully qualified table name of extension table for object identified by logical name. The first form provides the name of the table with the “default” extension attributes. The second form provides the name of the table that contains the row(s) of an extension collection. |
FROM<%SCHEMA%>.FCI_MAS_SUPPLIER<%EXT_TABLE(masterdata.Supplier)%> |
<%RESULTS%> |
Tells the query component to build the list of columns for the SQL SELECT clause from the information entered on the Result Fields tabs of the Query Definition object. |
SELECT<%RESULTS%>FROM<%SCHEMA%>.FCI_MAS_CURRENCY |
<%ORDERBY%> |
Tells the query component to build the SQL ORDER BY clause based on the sorting information entered on the Result Fields tab of the Query Definition object. |
SELECT<%RESULTS%>FROM<%SCHEMA%>.FCI_MAS_CURRENCY<%ORDERBY%> |
<%RES_ID(resourceId)%> |
Finds locale-specific string for resource ID. |
COALESCE(T1.PHONE_1,<%RES_ID(cterms$cterm.not_available_in_brackets)%> |
<%CLASS_RES(class-id)%> |
Provide the resource ID that is associated with an object type. As with any resource ID, it can be used to display a string or, with a “.image” suffix, an icon. This is resolved when the result set is retrieved. |
'<%CLASS_RES(' <%+%> RTRIM(CAST(T3.PARENT_CLASSID AS CHAR(12))) <%+%> ')%>' |
<%PROPS(appId,propId)%> |
Finds the string value of the system property that is identified by the appId and propId combination. |
<%PROPS(system, system.default.language)%> |
<%ARGn%> |
If a string, URL, or string resource query column definition has Resolve attribute(s) in Value checkbox set, and one or more attributes of the form <%ARGn%> returned in the value of the column, each of these attributes will be replaced by the string form of the nth result item following the defined column. |
The expiration date of this material is <%ARGn%>
If this attribute is the database column name of a string column, for example, and the 1st column after that contains a date, then the date value will replace the <%ARG1%> attribute. End of the note. |
<%REQUEST_PAGE_PATH%> |
Echoes the properly formatted URL to the current page. Used by queries to generate internal page links to other (drill-down) queries, especially when the same query can be executed from multiple pages, for example, Picker queries. |
'<%REQUEST_PAGE_PATH%>' <%+%> 'queryGroupName=FCI-AllCategories' |
<%REQUEST_PATH_OBJ%> |
Gets the part of the HTML request path that identifies a target object. This is between the first and second commas in the path. Usually, this is a simple object reference. |
'<%REQUEST_PAGE_PATH%>,<%REQUEST_PATH_OBJ%>>?rqaction=markinactive=') <%+%> RTRIM(CAST(OBJECTID AS CHAR(12))) <%+%> ':619', |
<%BASE_SERVLET_PATH%> |
Gets the base servlet path, which is the part of an internal page link that starts with the http protocol and includes the host name, port (if any), application name (if any), and servlet name. Example: http://fc-xxxyyyzzz:8100/sourcing/fspurchaser. This is used when the URL string is embedded in the column value, precluding the automatic prefixing of the base servlet path for an internal page link. In the Usage example, the column type is external page link so that the prefixing will not be done. |
'javascript:confirmAndPostUrl(''<%BASE_SERVLET_PATH%><%REQUEST_PAGE_PATH%>,<%REQUEST_PATH_OBJ%>rqaction=markinactive=' <%+%> RTRIM(CAST(OBJECTID AS CHAR(12))) <%+%> ':619'',''' <%+%> <%RES_ID(system$system.ui.confirmation.delete)%> <%+%> ''')' |
<%LOAD_PAGE(logicalName,objectId)%> |
Resolves to an SQL string concatenation expression to compose the URL that will load the referenced document. |
<%LOAD_PAGE(doc.auction.multi.universal.auctionevent,T1.OBJECTID)%> |
LOAD_PAGE_CLASSID(classId,objectId) |
Resolves to a URL that loads the referenced document. classId and objectId are integers.
This attribute is optionally resolved for each link column value in the result set, unlike LOAD_PAGE, which is resolved before the query executes. End of the note. |
'<%LOAD_PAGE_CLASSID(' <%+%> RTRIM(CAST(T2.CLASSID AS CHAR(12))) <%+%> ',' <%+%> RTRIM(CAST(T2.OBJECTID AS CHAR(12))) <%+%> ')%>' |
<%DISCUSSIONS_PAGE(classId,objectId)%> |
Resolves to an SQL string concatenation expression to compose the URL that will load the discussions page for the referenced document. |
<%DISCUSSIONS_PAGE(T1.PARENT_CLASS_ID,T1.PARENT_OBJECT_ID)%> <%+%> '=' <%+%> RTRIM(CAST(T1.OBJECTID AS CHAR(12))) <%+%> ':380 |
<%DUPLICATE_DOC(logicalName,objectId)%>
<logicalName> refers to the value in the Class ID column of the Class List table located in the Class Reference section of the online Reference Guide (RG). End of the note. |
Resolves to an SQL string concatenation expression to compose the URL that will duplicate the referenced document. |
<%DUPLICATE_DOC(rfx.RFXDoc,T1.OBJECTID)%> |
<%MULTIPICKER_FIELD_PARAMS%> |
This attribute is specifically designed for building internal page links within queries designed for multi-select pickers. For an example, see the Category and Supplier Tree Browse queries. The multi-select picker needs a number of context parameters to manage the activation of multiple selections. This attribute echoes those parameters when linking to a new query page as additions to the internal page URL. Note that the attribute includes a leading, but not trailing, & delimiter for the parameters. |
<%REQUEST_PAGE_PATH%>' <%+%> 'queryGroupName=FCI-AllCategories' <%+%> <%MULTIPICKER_FIELD_PARAMS%> <%+%> '=' <%+%> RTRIM(CAST(OBJECTID AS CHAR(12))) |
<%SOURCE_OBJREF_PARAM%> |
Compose a URL parameter with the simple object reference of the report being executed, so that its query parameter values will be shared with the linked report or query group. |
'/comp/selection?queryGroupName=FCI-DimensionCustom4LowerLevel&<%SOURCE_OBJREF_PARAM%>' |
<%CHECKCOLLAB_TBL(parentObjectId,parentClassId, KeyValues)%> |
The token resolves to SQL that performs the collaborator checks and also provides data about the kind of collaboration in a table whose alias is 'COLLAB'. It is included in the query as either an inner JOIN or a LEFT OUTER JOIN. In many cases, using this token will result in much better performance compared to using one of the check collaborator SQL functions. |
‘CONTRACT’ is a table alias. For additional information, see the section Using the CHECKCOLLAB_TBL Attribute. |
<%MS_JOIN%> |
Single attribute <%MS_JOIN%> should be placed in the from clause to join to the multi string sub table. If <%DYN_JOIN%> is present, do not use <%MS_JOIN%> because when <%DYN_JOIN%> is resolved, it will automatically insert a <%MS_JOIN%> attribute |
<%MS_JOIN%> |
<%MS(columnname,classname)%> |
This attribute can be used to get the localized value of a Multi String field in the result set based on the current user’s locale |
<%MS_NAME_FILTER(T1,masterdata.Material,SearchName)%> |
<%AND_OP(“columnName”,<%?(paramName)%>)%> |
Compose a filter condition and add it to the WHERE clause if the named parameter in the token has a value provided for it. “columnName” is an SQL expression, typically simple. The operator in the condition is provided by the parameter definition. The operator can often be changed at run time in the UI. |
<%AND_OP(“UPPER(T1.DISPLAY_NAME)”,<%?(T1.DISPLAY_NAME)%>)%> |
<%DYN_JOIN%> |
Add JOIN conditions for tables that contain fields that are dynamically added for display or filtering. The token should be placed after the object’s header table name and alias. |
FROM <%SCHEMA%>.FCI_PRO_PROJECTS T1 <%DYN_JOIN%> JOIN <%SCHEMA%>.FCI_PRO_SCHEDITEMS T3 ON T1.OBJECTID = T3.PARENT_OBJECT_ID |
<%DYN_FILTER%> |
Add conditions to the WHERE clause for columns that are dynamically added for filtering. |
WHERE T1.INACTIVE = <%?(T1.INACTIVE)%> AND T1.CONTEXTID = <%CONTEXT(projects.projects)%> <%DYN_FILTER%> AND T3.NEED_REMINDER = 1 |
The AND_OP attribute is used to enable the user to change the query filter operator dynamically. In the past. all operators were hardcoded in the SQL statement and appeared in the condition in the WHERE clause. The new attribute is used to inject the SQL operator (e.g., =, <, >, IN (….), <>) into the WHERE clause before execution.
The operator injection will be done only for optional parameters. The AND_OP attribute will be needed for each optional parameter.
The AND_OP syntax: <%AND_OP(“columnName”,<%?(paramName)%>)%>
columnName = The content of columnName must be surrounded with double quotes “ “. Inside the “ “ will be the column name to be filtered. The columnName format could be any legal SQL expression for column name, such as:
“table alias,name of column to be filtered"
For example: “T2.PROJECTXREF_OBJECT_ID”
Sql Operation>(name of column to be filtered)
For example: “UPPER(T1.DISPLAY_NAME)”
paramName = Unique identifier from the query parameter definition. It will be associated with a filter value that the user enters.
For example, if there are 2 parameters which can have filter values entered for them, and they have parameter definition names of E1.PROJECTXREF_OBJECT_ID and E1.SPECIAL_SAUCE, then the SQL string will be:
… WHERE T1.INACTIVE = <%?(T1.INACTIVE)%> AND T1.CONTEXTID = <%CONTEXT(projects.projects)%> <%AND_OP(“E1.PROJECTXREF_OBJECT_ID”,<%?( E1.PROJECTXREF_OBJECT_ID)%>)%> <%AND_OP(“E1.SPECIAL_SAUCE”,<%?( E1.SPECIAL_SAUCE)%>)%> AND T3.NEED_REMINDER = 1 ...
Each AND_OP attribute would be expanded to a legal SQL condition expression, depending on the operator that was selected by the user for each filter.
Each operator chosen from the UI will be translated to the matching SQL operator. For example:
“Equals” : ”=”
“Not Equals” : “<>”
“Starts With” : “LIKE X%”
“Contains” X : “LIKE %X%”
If the “Equals” operator, is chosen, then
<%AND_OP(“E1.PROJECTXREF_OBJECT_ID”,<%?( E1.PROJECTXREF_OBJECT_ID)%>)%>
will be replaced wtih
AND E1.PROJECTXREF_OBJECT_ID = ?
The ‘?’ would then be bound with the parameter value that is associated with the parameter name.
A complete query string example:
SELECT <%RESULTS%>
FROM <%SCHEMA%>.FCI_MAS_COMPANY T1 <%DYN_JOIN%>
WHERE T1.INACTIVE = <%?(T1.INACTIVE)%>
AND T1.CONTEXTID=<%CONTEXT(masterdata.company)%>
<%DYN_FILTER%>
<%AND_OP(“UPPER(T1.DISPLAY_NAME)”,<%?(T1.DISPLAY_NAME)%>)%>
<%AND_OP(“T1.LOCATION_OBJECT_ID”,<%?(T1.LOCATION_OBJECT_ID)%>)%>
<%ORDERBY%>
Rules
If any AND_OP attributes are used, there can be no standalone parameter markers (?) in the same query string.
For each query parameter filter that is defined as not “Fixed”, there must be a matching AND_OP attribute for that parameter in the query string to enable the changeable operator behavior.
The AND_OP attribute must be provided for a param with “Optional” flag set to true.
Params with “Optional” flag set to “false” (i.e., required) should not use AND_OP attributes.
If there is no parameter value for an AND_OP attribute, it will be removed from the WHERE clause.
If there are no parameters values for any AND attribute that follows a WHERE clause that, and the WHERE clause is empty without the attribute, the "WHERE" will be removed.
The query string contains a placeholder (?) for each query parameter, including optional ones. Each placeholder is substituted with the parameter's value or with a type-specific default value when the parameter value is not provided.
The AND attribute is used to exclude a complex condition in the WHERE clause that is associated with one or more optional parameters when their values are not provided.
This attribute has parameter. The parameter is a string specifying the SQL condition that will be inserted in place of the attribute if all the query parameters have values provided for them. If no values are provided for any of the query parameters, this attribute will be substituted with an empty string. Values must be provided for all or none of the parameters that are named in the first attribute; otherwise, an error message will be displayed.
Example: a query string with one optional parameter that is part of a more complex SQL condition:
SELECT<%RESULTS%>FROM<%SCHEMA%>.FCI_MAS_VENDOR WHERE T1.INACTIVE = <%?(T1.INACTIVE)%> AND T1.CONTEXTID=<%CONTEXT(masterdata.Vendor)%> <%AND(“(T1.DISPLAY_NAME LIKE <%?(Name)%> OR T1.DOCUMENT_DESCRIPTION LIKE <%?(Name)%>”))%> <%ORDERBY%>
If the parameter value is provided, attribute substitution will produce the following:
SELECT T1.UNIQUE_DOC_NAME, T1.OBJECTID, 607 AS CLASSID, T1.DISPLAY_NAME, T1.DOCUMENT_DESCRIPTION, T1.CREATED_BY_USER_OBJECT_NAME, T1.MODIFIED_AT, UPPER(T1.DISPLAY_NAME) FROM FCI_MAS_VENDOR T1 WHERE T1.INACTIVE = 0 AND T1.CONTEXTID=-2147483548 AND (T1.DISPLAY_NAME LIKE ? OR T1.DOCUMENT_DESCRIPTION LIKE ?) ORDER BY 8
The CONTEXT attribute is an extremely important component of query development. The SAP Sourcing application allows master data objects and business documents to be associated with an organizational unit, and to limit access to those objects to users that are also associated with that business unit. Additional levels of security in the product provide more granular control, but the organizational unit level partitioning is the first level.
The SAP Sourcing application supports two levels of organizational units for this data security feature: enterprises and companies, where companies are contained within an enterprise. It is not necessary to use this partitioning in an implementation, which can be modeled as one enterprise, using other attributes to identify the business owner of the document, without blocking data access based on the organizational unit. Additionally, different classes of objects or documents can be scoped at different levels, for example, there can be one set of Supplier information shared across the enterprise, with RFPs, Auctions and Contracts isolated at the company level.
In most cases, it is desirable for queries to show users only those objects or documents that they subsequently have access to, for example, if there are RFPs associated with two separate companies within an enterprise stored in the database, users from one company should only be allowed to see the documents that are associated with their company. This is controlled in part by a CONTEXTID column in the top-level database row associated with that document, and managed by the SAP E-Sourcing framework.
For queries, the correct approach is to include a WHERE clause filter to check the context ID against the context association of the current user. The CONTEXT attribute simplifies this step: the software understands whether the object being queried is enterprise-scoped or company-scoped, and, based on the logged-in user, knows the ID of the user's associated enterprise or company. The required WHERE clause segment is therefore AND CONTEXTID = CONTEXT(name), where name is the logical class name of the object being queried.
To find the logical class name of an object, its integer class ID, or its table name, see the Class Reference section of the on-Line Reference Guide (RG). To see the table name, go to the object's schema view.
The CONTEXT attribute has a slightly different behavior for queries executed by sell-side users. For a company-scoped object (for example, RFxs), the CONTEXT attribute returns a comma-separated list of all of the context IDs that are children of the enterprise context containing the supplier. Since Suppliers and Contacts are typically enterprise-scoped, they can be invited to events by any company in any context that is part of that enterprise context. The unique sell-side behavior of the CONTEXT attribute ensures that sell-side queries can also see the full set of business documents in any context that is part of that enterprise. Supplier access to those documents is typically further controlled by whether the supplier is invited to participate. Using the comma-separated list returned by the CONTEXT attribute on the sell side implies a WHERE clause filter using the SQL IN, instead of the = operator used with single values.
This section describes the use of the ARGn attribute, including examples.
If a String, URL, or String Resource query column definition has the Resolve attribute(s) in Value checkbox set, and one or more attributes of the form <%ARGn%> returned in the value of the column, each of these attributes will be replaced by the string form of the nth result item following the defined column.
Example of providing date in user's format:
Define a String column A with the Database Column Name of:
The expiration text of this material is <%ARG1%>
Define a hidden Date column B following column A.
Each value returned for A will have the properly formatted date inserted in the place of the ARG1 attribute. B is expected to be hidden, though it is not required.
Multiple argument attribute example:
Define a String column A with the Database Column Name of:
CASE WHEN PRIMARY_UNIT = 1 THEN '<%ARG2%>' ELSE SYNONYMS <%+%> '<%ARG1%>' END
followed by three columns (OBJECTID, class ID literal, DISPLAY_NAME) and then by two more columns (numeric amount and unit of measure).
The first three columns compose an object reference result item. The following two columns compose a quantity (dimensioned numeric) result item. If PRIMARY_UNIT = 1, then the value of column A will be the quantity in string form (because it is the second result item after column A). If PRIMARY_UNIT <> 1, then the value of column A will be the value of the SYNONYMS column concatenated with the string form of an object reference (because the object reference is the first result item after column A).
This is not a logical example, but it illustrates the use of multiple arguments in any order. It also highlights the rule that ARGn means the nth result item, not the nth column.
Resource ID example:
Define a String Resource column A with the Database Column Name of:
'auction$auction_bidder_status'
This literal resource ID will initially resolve to a locale-specific string. If this string has ARGn attributes in it, then the string would be resolved further by replacing the attributes with the values of the corresponding result items after column A. This behavior is not obvious from looking at the query definition, so it should be applied only when the output value must vary by locale.
Other rules are as follows:
Note that an ARGn attribute with the same value for n can appear multiple times. That is, ARG3 can be used more than once in the same column.
There can be gaps in the argument numbering. For example, ARG1 and ARG4 can be the only attributes used.
The number of result items following a column definition with ARGn attributes must be greater than or equal to the highest value of n. If ARG4 is used, then there must be at least four result items following the column that uses the attributes.
The URL intended column type is supported, but not the internal or external link fragment column types. The URL is the column whose value is displayed in the UI.
Some types of documents restrict access to a list of assigned collaborators. Query developers can determine whether the current user is a collaborator using this token.
The token resolves to SQL that performs the collaborator checks and also provides data about the kind of collaboration in a table whose alias is 'COLLAB'. It is included in the query as either an inner JOIN or a LEFT OUTER JOIN. In many cases, using this token will result in much better performance compared to using one of the check collaborator SQL functions.
This token takes the following three arguments:
CHECKCOLLAB_TBL( parent_objectid_column,
classid | logical classname | parent_classid_column,
keyvalue
)
The first two arguments relate to the JOIN columns and are required.
The first argument is the ObjectId column of the document. This is the document on which the collaborator check will be performed.
The second argument is the ClassId of the document. This can be the actual class ID, a column ID, or the logical class name. One or more of these values must be provided.
In some queries, the second argument can be a list of class ID entries and a column ID. If a class ID is provided, it will be used to filter the collaborator data and helps to improve performance. The class ID allows the scan of the collaborator table to ignore collaborator rows that match the document class.
The third argument is a list of key/value pairs. The third argument is optional.
There is 1 supported key:
IS_SILENT=TRUE or IS_SILENT=FALSE: Only specify if you want to restrict the query results to active collaborators or non-active (silent) collaborators. In general, IS_SILENT is not
specified in queries. Use IS_SILENT=FALSE to limit results to active collaborators.
The COLLAB data contains the following columns; PARENT_OBJECT_ID, PARENT_CLASS_ID, IS_SILENT. All these fields are set unless a LEFT OUTER JOIN is used. In this case, all these
fields will be NULL when the user is not a collaborator on the document.
IS_SILENT is either 0 or 1. 0 indicates that the user is a collaborator who receives notifications when the document is modified and the changes are configured to send alerts and e-mails. 1 indicates that the user does not receive notifications and generally
indicates that the user is not expected to be an active participant on the document.
SQL can be included in a query that checks the COLLAB data. This is more common when this token is used with a LEFT OUTER JOIN. In this case, the test is a simple CASE. For example:
CASE WHEN COLLAB.PARENT_OBJECT_ID IS NOT NULL THEN <%LOAD_PAGE(contracts.Agreement,T2.OBJECTID)%> ELSE NULL END AS LINK,
Since Multi String Master Data’s name and description values are saved in its own multi string sub table, query developer needs to join to that table to get the correct localized values. A few new attributes have been created to make the query development easier.
<%MS_JOIN%>: Single attribute <%MS_JOIN%> should be placed in the from clause to join to the multi string sub table. If <%DYN_JOIN%> is present, do not use <%MS_JOIN%>. When <%DYN_JOIN%> is resolved, it will automatically insert a <%MS_JOIN%> attribute.
Find “<%MS_JOIN%>” in the following Query String:
SELECT <%RESULTS%> FROM <%SCHEMA%>.FCI_MAS_MATERIAL T1
LEFT OUTER JOIN <%SCHEMA%>.FCI_MAST_MATERIAL_PLANT T2 ON T2.PARENT_OBJECT_ID = T1.OBJECTID
LEFT OUTER JOIN <%SCHEMA%>.FCI_MAS_PLANT T3 ON T3.OBJECTID = T2.PLANT_OBJECT_ID
<%MS_JOIN%>
WHERE T1.INACTIVE = 0 AND T1.CONTEXTID = <%CONTEXT(masterdata.Material)%>
<%AND_OP(“UPPER(<%MS(T1.NAME_MSDEFAULT,masterdata.Material)%>)”,<%?(SearchMaterial)%>)%>
<%ORDERBY%>
<%MS_JOIN%> would be resolved as:
LEFT OUTER JOIN ESO.ODP_ESO_MAS_MATERIALLS MS1 ON T1.OBJECTID=MS1.PARENT_OBJECT_ID AND T1.NAME_MSID = MS1.PARENT_COLLN_ID AND MS1.LANGUAGE_OBJECT_ID = -2147483448
<%MS(columnname,classname)%>: This attribute can be used to get the localized value of a Multi String field in the result set based on the current user’s locale. The Column Type should be Display Name or just a String. The first parameter of the <%MS%> attribute (column name) is used as the Column ID. If this attribute is present, it’s required that the query string has attribute <%MS_JOIN%> or <%DYN_JOIN%>, but not both.
For example, a result field with the Database Column Name of “<%MS(T1.NAME_MSDEFAULT,masterdata.Material)%>” would
have a Column ID of “T1.NAME_MSDEFAULT”.
The resolved string for this column might be: <%COALESCE%>(MS1.VALUE,T1.NAME_MSDEFAULT)
The “MS1” table alias is generated. The alias names for the multi-string tables will vary according to the complete set of multi-string fields being used in the SELECT statement.
<%MS(...)%> can also be used in a filter to enable searching localized values based on the current user’s locale:
<%AND_OP("UPPER(<%MS(T1.NAME_MSDEFAULT,masterdata.Material)%>)",<%?(SearchMaterial)%>)%>
The resolved string: AND UPPER(<%COALESCE%>(MS4.VALUE,T1.NAME_MSDEFAULT)) LIKE ?
<%MS_NAME_FILTER(table-alias,class_name,param-name)%>: This attribute provides a convenient way to search a string in the localized name and description columns. It will be resolved before attribute <%MS%>. If this attribute is present, it’s required that the query string has attribute <%MS_JOIN%> or <%DYN_JOIN%>, but not both.
Find “<%MS_NAME_FILTER%>” in the following Query String:
SELECT <%RESULTS%> FROM <%SCHEMA%>.FCI_MAS_MATERIAL T1
LEFT OUTER JOIN <%SCHEMA%>.FCI_MAST_MATERIAL_PLANT T2 ON T2.PARENT_OBJECT_ID = T1.OBJECTID
LEFT OUTER JOIN <%SCHEMA%>.FCI_MAS_PLANT T3 ON T3.OBJECTID = T2.PLANT_OBJECT_ID
<%MS_JOIN%>
WHERE T1.INACTIVE = 0 AND T1.CONTEXTID = <%CONTEXT(masterdata.Material)%>
<%MS_NAME_FILTER(T1,masterdata.Material,SearchMaterial)%>
<%ORDERBY%>
This <%MS_NAME_FILTER(table-alias,classname,param-name)%> will generate the content between the double quote:
<%AND("(UPPER(<%MS(T1.NAME_MSDEFAULT,masterdata.Material)%>) LIKE <%?(SearchMaterial)%> OR
UPPER(<%MS(T1.DESCRIPTION_MSDEFAULT,masterdata.Material)%>) LIKE <%?(SearchMaterial)%>)")%>
The resolved string: AND (UPPER(<%COALESCE%>(MS4.VALUE,T1.NAME_MSDEFAULT)) like ? OR UPPER(<%COALESCE%>(MS5.VALUE,T1.DESCRIPTION_MSDEFAULT)) like ?)