Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Mich90GSG_o
Contributor
Contributor

.NET SDK C# - Retrieve data of master vizualisation

Hey,

I am trying to implement a small C# application. At the moment I get my data by handling the hypercube which is not very readable and if something changes in the application I have also to change it in the C# code.

Therefor, the idea was to retrieve data of known master vizualisations (charts, tables, ...).

Does anyone have an example code of how to do this? Best thing would be to have a static method which just needs the IApp and the name of the master vizualisation.

Thanks in advance!

1 Reply
Øystein_Kolsrud
Employee
Employee

Something like this perhaps?

static IEnumerable<NxCellRows> GetMasterObjectData(IApp app, string objectTitle)
{
    var list = app.GetMasterObjectList();
    var id = list.Items.First(i => i.Meta.Get<string>("title") == objectTitle).Info.Id;
    app.DestroyGenericObject(list.Id);
    var o = app.GetGenericObject(id);
    var pager = o.GetAllHyperCubePagers().First();
    var allPages = pager.IteratePages(new[] {new NxPage {Width = pager.NumberOfColumns, Height = 100}}, Pager.Next).Select(pageSet => pageSet.Single());
    return allPages.SelectMany(page => page.Matrix);
}