Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

corchi72
New Contributor III

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

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

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

corchi72
New Contributor III

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

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

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

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

Community Browser