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 apps.
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. |
The sheet ID can be obtained from the app URL. For visualizations, use the Developer options to identify the object ID and the text string of the object type.
Do the following:
-
In analysis mode, add the following text to your URL:
/options/developer
-
Right-click a visualization and click Developer.
-
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.
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. |