Skip to main content Skip to complementary content

ObjectId - chart function

The ObjectId() chart function returns the ID of the object in which the expression is evaluated. The function takes an optional argument specifying which type of object the function concerns. The object can be a sheet or a visualization. This function is only available in chart expressions.

Syntax:  

ObjectId([object_type_str])

Return data type: string

The function's only argument, object_type_str, is optional and refers to a string value representing the type of the object.

Arguments
Argument Description
object_type_str A string value representing the type of the object being evaluated.

If no argument is specified in the function expression, ObjectId() returns the ID of the object in which the expression is used. To return the ID of the sheet object within which the visualization appears, use ObjectId('sheet').

In the case of visualization objects nested within other visualization objects, specify the desired object type in the function argument for different results. For example, for a Text & image chart within a container, use 'text-image' to return the Text & image object and 'container' to return the ID of the container.

  1. In analysis mode, add the following text to your URL:

    /options/developer

  2. Right-click a visualization and click Developer options icon Developer.

  3. Under Properties, obtain the object ID from the dialog header, and the object type from the "qType" property.

Limitations:  

This function can give unexpected results when invoked in an object (for example, a button) inside a container which is a master item. This limitation also applies to filter pane master items, which are containers for a number of listboxes. This is because of how master items use the object hierarchy.

The chart expression ObjectId('sheet') will return an empty string in those cases, whereas ObjectId('masterobject') will show the identifier of the owning master item.

ObjectId() is often used in combination with the following functions:

Related functions
Function Interaction
if - script and chart function The if and ObjectId functions can be used together to create conditional expressions. For example, visualizations might achieve conditional coloring through expressions using these functions.
InObject - chart function Similar to if, InObject is also used with ObjectId to create conditional expressions.

Example 1 – Return chart object ID

Example 2 – Return sheet ID

Example 3 – Nested expression

For a more detailed example using conditional coloring, see the example on InObject - chart function.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!