ObjectXML

You can use the ObjectXML function to retrieve XML data for an Optiva object. This function exports object data in XML format, including header information and specified detail sections, with optional multi-language supports.

When to use

You can use this function when you need to export object data in XML format.

Syntax

string ObjectXML(string objSymbol, string objKey, string dtls, string languageCodes = null)

Parameters

Parameter Type Required Description
objSymbol string Yes

The symbol of the object.

Note: You can use empty quotation marks ("") for the current workflow symbol.
objKey string Yes

The key of the object.

Note: You can use empty quotation marks ("") for the current workflow symbol.
dtls string Yes The detail codes that identify the data sections to include in the XML. Use a semicolon-delimited list to specify multiple detail codes. For example, "HEADER;INGR;TPALL''
Note: An empty string ("") returns only the HEADER detail code.
languageCodes string Optional he language codes used to export enumerated value lists in multiple languages. You can use a semicolon-delimited list to specify multiple language codes. For example, "EN-US;FR-FR;DE-DE"
Note: If you do not specify this parameter, the database default language is used. Usually it is EN-US.

Return Value

The application returns the XML data for the specified Optiva object.

Structure:
  • Well-formed XML document.
  • Includes object header information.
  • Contains requested detail sections as XML nodes.
  • Multi-language enumerated values if language codes specified.
  • Schema follows Optiva XML standards.

Impact

This function cannot be modified, and is an export function.

Prerequisites

  • The detail codes must be valid for the object type.
  • The language codes must be enabled by the system.

Special Detail Codes for Formula BOM

Detail Code Description Equivalent Item Contribution Form View
INGRMULTI The materials in formula BOM. The default item contribution view.
INGRMULTIRM The exploded materials in formula BOM The "Explode to Constituents" is enabled.
INGRMULTINM The materials and non-materials items. The "Display Non-Materials" is enabled.
INGRMULTINMRM The exploded materials and non-materials. The "Explode to Constituents" + "Display Non-Materials" is enabled.

Examples

Example 1
Retrieve XML data of current object & key in EN-US and FR-FR languages.
string xml = ObjectXML("", "", "HEADER;CUSTOM;TPALL", "EN-US;FR-FR");
Description
This example retrieves the XML data of the current object covering detail codes "HEADER", "CUSTOM", and "TPALL" along with multi language data(EN-US, FR-FR).
Example 2
Retrieve XML data of current object.
string xml = ObjectXML("", "", "");
Description

This example retrieves the XML data for the current object, returning only the HEADER detail code because an empty string is passed as the detail code argument.

Example 3
Retrieve Materials in Formula BOM.
string BOMXML = ObjectXML("FORMULAADJUST", _ObjectKey, "HEADER;INGRMULTI");
Description
This script retrieves the materials in a formula BOM. It shows the same information as the Item Contribution form.
Example 4
Retrieve Exploded Materials.
string BOMXML = ObjectXML("FORMULAADJUST", _ObjectKey, "HEADER;INGRMULTIRM");
Description
This script retrieves the exploded materials in a formula BOM. It shows the same information as when you specify Explode to Constituents on the Item Contribution form.
Example 5
Retrieve Materials and Non-Materials.
string BOMXML = ObjectXML("FORMULAADJUST", _ObjectKey, "HEADER;INGRMULTINM");
Description

This script retrieves the exploded materials and non-materials items in a formula BOM. It shows the same information when you specify Explode to Constituents and display non materials on the Item Contribution form.

Example 6
Retrieve Exploded Materials and Non-Materials.
string BOMXML = ObjectXML("FORMULAADJUST", _ObjectKey, "HEADER;INGRMULTINMRM");
Description
You must include a format code and a parameter type to retrieve parameters.
Example 7
Retrieve Rollup Parameters.
string BOMXML = ObjectXml("FORMULAADJUST", _objectKey, "INGRMULTI.A\\PARAM ROLLUP");
Description
INGRMULTI retrieves the material ingredients, but you must request “INGRMULTI.A\PARAM ROLLUP” to see the rollup parameters.
Example 8
Retrieve Cost Parameters.
string BOMXML = ObjectXml("FORMULAADJUST", _objectKey, "INGRMULTI.A\\PARAM COST");
Description
INGRMULTI retrieves the material ingredients, but you must request “INGRMULTI.A\PARAM ROLLUP” to see the rollup parameters.

Edge Cases

  • Using empty quotation marks ("") for objSymbol and objKey retrieves data for the current workflow object.
  • Passing an empty string for dtls returns only the HEADER detail code.
  • Specify multiple language codes by separating them with semicolons.