Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how can I read the title of each individual object in a sheet

I tried the following code and it works but if besides the name I wanted to read the title of each object what should I write?

Example: List Qlik Sense objects on a sheet

  foreach (IGenericObject child in sheet.Children)

  {

                Console.WriteLine("Type:{0} ID:{1}", child.Info.Type, child.Info.Id);

  }

Thanks Corchi

3 Replies
Not applicable
Author

Hi,

In order to get the title of the child you will have to get the child. See below.

Console.WriteLine("Type:{0} ID:{1} Title:{2}", child.Type, child.Id, ((VisualizationBase)child.GetChild(child.Id)).Title);

// Lars-Göran Book

Anonymous
Not applicable
Author

Additional information: Impossibile eseguire il cast di oggetti di tipo 'Qlik.Engine.GenericObject' sul tipo 'Qlik.Sense.Client.Visualizations.VisualizationBase'.

this is the casting error that occurs if I execute the code below:

Console.WriteLine("Type:{0} ID:{1} Title:{2}", child.Type, child.Id, ((VisualizationBase)child.GetChild(child.Id)).Title);

corchi

Not applicable
Author

You could try using a dynamic cast to access the Title property, just remember that this will fail if your objects doesn't have support for this property.

ex:

Console.WriteLine("Type:{0} ID:{1} Title:{2}", child.Info.Type, child.Info.Id, ((dynamic)child).Title);


Regards,

Johan Tejle