InObject - chart function
The InObject() chart function evaluates whether or not the current object is contained inside another object with the ID specified in the function argument. The object can be a sheet or a visualization.
This function can be used to show the hierarchy of objects in a sheet, from the top-level sheet object to visualizations nested within other visualizations. This function can be used alongside the if and ObjectId functions to create custom navigation in your applications.
Syntax:
InObject(id_str)
Return data type: Boolean
In Qlik Sense, the Boolean true value is represented by -1, and the false value is represented by 0.
| Argument | Description |
|---|---|
| id_str | A string value representing the ID of the object being evaluated. |
You can use the Embed menu to obtain object IDs.
Do the following:
-
In analysis mode, right-click a visualization or sheet, and then click
Share >
Embed.
-
Copy the object or sheet ID.
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.
InObject() is often used in combination with the following 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. |
| ObjectId - chart function | Similar to if, ObjectId is also used with InObject to create conditional expressions. |

