Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
anyone got an example for me in c# or point me in the right direction?
There is a public example for traversing apps and retrieving master objects using the .NET SDK.
https://github.com/AptkQlik/PublicExamples/tree/master/AppTraverser
There is a public example for traversing apps and retrieving master objects using the .NET SDK.
https://github.com/AptkQlik/PublicExamples/tree/master/AppTraverser
Thanks!
This didn't quite work afterall .. it works fine on the LicenseMonitor app and the Operational app .. but when i create in a new all some master items .. they wont show. any idea why this is?
Sounds to me like this is the method you are looking for: AppExtensions.GetMasterObjectList Method
can you elaborate a bit?
Qlik.Sense.Client.IMasterObjectList masterobjects = Qlik.Sense.Client.AppExtensions.GetMasterObjectList(app);
This .. and then what? How do i loop though the objects?
Once you have the IMasterObjectList instance, you can access the information about which master objects are available from the layout of the list. To get the layout, you would do like this:
var listLayout = masterObjectList.GetLayout().As<MasterObjectListLayout>();
Then the set of object IDs for the master objects are available from this property: MasterObjectListLayout.AppObjectList Property
Those IDs can in turn be used to get the actual objects using the "GetObject" method from the app. So the full code would probably look something like this:
var masterObjectList = app.GetMasterObjectList();
var listLayout = masterObjectList.GetLayout().As<MasterObjectListLayout>();
var objectIDs = listLayout.AppObjectList.Items.Select(item => item.Info.Id);
var objects = objectIDs.Select(id => app.GetObject<GenericObject>(id));
Or, if you prefer, you could use the "Items" shortcut on the masterObjectList object to avoid having to explicitly go through the layout. (You will go through the layout anyway, but it will be taken care of in the background.) In that case the code would look like this:
var masterObjectList = app.GetMasterObjectList();
var objectIDs = masterObjectList.Items.Select(item => item.Info.Id);
var objects = objectIDs.Select(id => app.GetObject<GenericObject>(id));
Hi there...
I've tried your solution but the AppObjectLlist always comes back with a Count of 0.
As a bit of background on what I'm trying to achieve:
I have several apps... with 100+ master dimensions / measures each. Essentially, I want a ist of each master item along with its description.
Any help will be gratefully received
Ta in advance,
Mat
The MasterObjectList will only contain references to generic objects. If you want to list master dimensions and measures, then you need to use these methods instead:
Thanks for this... but as it happens, I posted the question and then worked it out for myself 😄
Listing master items using .NET SDK
Nice to see I got the same solution as you proposed though