Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get object list using .Net SDK

Hi All,

I am using .net sdk to integrate qlik in my application. I am showing the list of App in dropdown control. I need to show list of object with Title in particular app. For this purpose currently i am fetching list of sheet in app then list of object from sheet.

Code sample :

          //Here i am fetching list of sheet in app

            List<SheetObjectViewListContainer> sheetList= null;

            var appIdentifier = location.AppWithId(appId, noVersionCheck: true);

            using (IApp app = location.App(appIdentifier, noVersionCheck: true))

            {

                sheetList = app.GetSheetList().Items.ToList();

            }

         

          //here i am fetching list of object from sheet by loop

            foreach (SheetObjectViewListContainer sheet in sheetList)

            {

                foreach (var item in sheet.Data.Cells)

                {

                    string objectID= item.Name;

                    string objectType= item.Type;

                 }

                }

            }

Note: Problem is i am not able to show title of object

So how can i get title of object.

1 Solution

Accepted Solutions
Øystein_Kolsrud
Employee
Employee

Ah, sorry... I misread your original request. To get the title of the objects (I assume you want the evaluated title, not the title definition) you will have to get the layout of the individual objects. Note that not all objects necessarily have a title, but all the standard Qlik Sense visualization do and are extensions of the base class VisualizationBase in the SDK. To get the title of all those visualizations, you can do like this:

foreach (var sheet in app.Sheets())

{

     foreach (var child in sheet.GetChildInfos()

                                .Select(o => app.GetGenericObject(o.Id))

                                .OfType<IVisualizationBase>())

     {

          Console.WriteLine("Title: " + child.Title);

     }

}

You might also want to check out this example that illustrates how to traverse an app to extract data from it:

http://help.qlik.com/en-US/sense-developer/3.1/Subsystems/NetSDKAPI/Content/CodeExamples/App-Travers...

Or this example that illustrates how to trigger the computation of the layout of all objects in an app:

http://help.qlik.com/en-US/sense-developer/3.1/Subsystems/NetSDKAPI/Content/CodeExamples/App-Preload...

View solution in original post

7 Replies
Øystein_Kolsrud
Employee
Employee

Hi! The title is available in the "Meta" property of the SheetObjectViewListContainer instance, but it is not visible as part of the of that C# class. You can, however, access the information through the generic AbstractStructure.Get method like this:

foreach (var sheetItem in app.GetSheetList().Items)

{

  Console.WriteLine(sheetItem.Meta.Get<string>("title");

}

For more information on AbstractStructure, please refer to this page:

http://help.qlik.com/en-US/sense-developer/3.1/Subsystems/NetSDKAPI/Content/HowTos/Net-Sdk-How-To-Ab...

Another option is to open the sheets and get the title through the properties of the sheet directly like this:

foreach (var sheet in app.GetSheets())

{

  Console.WriteLine(sheet.Properties.MetaDef.Title);

}

The first approach has the advantage that you don't need to do the extra communication to open the sheet objects and asking for their properties, but if you're anyway going to open the sheets, then this second approach should be fine.

Not applicable
Author

Hi,

Thanks for your reply.

It does not work in my case because i need title of object within sheet. Your code is giving title of sheet.

Øystein_Kolsrud
Employee
Employee

Ah, sorry... I misread your original request. To get the title of the objects (I assume you want the evaluated title, not the title definition) you will have to get the layout of the individual objects. Note that not all objects necessarily have a title, but all the standard Qlik Sense visualization do and are extensions of the base class VisualizationBase in the SDK. To get the title of all those visualizations, you can do like this:

foreach (var sheet in app.Sheets())

{

     foreach (var child in sheet.GetChildInfos()

                                .Select(o => app.GetGenericObject(o.Id))

                                .OfType<IVisualizationBase>())

     {

          Console.WriteLine("Title: " + child.Title);

     }

}

You might also want to check out this example that illustrates how to traverse an app to extract data from it:

http://help.qlik.com/en-US/sense-developer/3.1/Subsystems/NetSDKAPI/Content/CodeExamples/App-Travers...

Or this example that illustrates how to trigger the computation of the layout of all objects in an app:

http://help.qlik.com/en-US/sense-developer/3.1/Subsystems/NetSDKAPI/Content/CodeExamples/App-Preload...

Not applicable
Author

Thanks for help

ozcano
Contributor III
Contributor III

Hello

Do you know how to extract info from the objects which are inside a container?

Regards

Øystein_Kolsrud
Employee
Employee

That depends on what type of object you want information for. Is it a master visualization, or a sheet, or something else? And what kind of information are you looking for. Is it the title?

Anyway, I suggest you create a new thread on this here in Community so that it doesn't get mixed up with this old thread.

ozcano
Contributor III
Contributor III

Hello

I started this thread. All the details are there. Help will be appreciated:

https://community.qlik.com/t5/Integration-Extension-APIs/Traverse-an-qlik-sense-app-to-extract-data-...

Regards

Ozcan