Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
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