Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

.net sdk how to get values of fields inside qlik sense app

Hi,

    I want to access values of fields inside the qlik sense app. Right now, I am getting list of field names but, I also want to access values of the fields. I am using .net SDK. Please help! since I am new to c#, I don't know the advance coding in c#.

1 Solution

Accepted Solutions
Øystein_Kolsrud
Employee
Employee

The NxPage structure defines a rectangle of cells from the table produced by the hypercube. The "Top" and "Left" properties indicates the top left corner of the rectangle, and the "Height" and "Width" properties indicates its size. If you only want the second column you should use the following page (columns are indexes from 0):

new NxPage { Top = 0, Left = 1, Height  = 20, Width = 1 };

View solution in original post

17 Replies
Øystein_Kolsrud
Employee
Employee

You should probably check out this method:

AppExtensions.GetAppField Method

There is a small example to look at here:

App fields ‒ Qlik Sense Developers

Anonymous
Not applicable
Author

Thanks, but the problem now has been resolved. If you could help me to create barcharts or piechats(or any chart) on the fly by using measures and dimensions using .net sdk that will be great.

Øystein_Kolsrud
Employee
Employee

The ISheet Interface has a number of methods for doing that type of operations. If you open the sheet where you want to add the visualization, then you can use this method to add a basic bar chart:

ISheet.CreateBarchart Method (String, BarchartDataContainer)

Any customization of the bar chart (like choosing orientation or setting colors) would have to be done by modifying the properties of the GenericObject returned by CreateBarchart.

Anonymous
Not applicable
Author

As you know In qlik app there are multiple sheet and each sheet contain multiple objects(bar chart, pie chart or any other type). I am able to get the object ID and I am also able to find out if it is barchart or piechart but I want to access data within that chart(text or chart doesn't matter). how can I achieve that.

Øystein_Kolsrud
Employee
Employee

This page is probably of interest to you: Retrieving data ‒ Qlik Sense Developers

The concept of "hyperubes" is at the core here, since that is the structure used by Qlik Sense to aggregate the data. You should also look into this page, which describes a class provided with the .Net SDK for doing paging across hypercubes (and list objects):

Paging of data ‒ Qlik Sense Developers

Typically, the flow would be something like this:

var obj = app.GetObject<GenericObject>("theid");

var pager = obj.GetAllHypercubePagers().First();

var data = pager.GetData();

Or if you know the object is a bar chart, then you can do like this:

var barchart = app.GetObject<Barchart>("theid");

var data = barchart.HyperCubePager.GetData();

There is also a project available here that further illustrates how to work with hypercubes in the .Net SDK: Qlik Branch

Anonymous
Not applicable
Author

thanks but it is giving me System.Collections.Generic.List`1[Qlik.Engine.NxDataPage]  output when I am printing var data in console. I am not getting data. I was trying 2nd solution.

Øystein_Kolsrud
Employee
Employee

The result returned by GetData is a list of data pages corresponding to the pages requested in the call. Default page set for GetData is a single page containing the first 20 entries. To access the actual value, you would do something like this (Num value used in this case):

var dataPages = pager.GetData();

var numValues = dataPages.First().Matrix.SelectMany(row => row.Select(cell => cell.Num));

Anonymous
Not applicable
Author

thanks I am able to get the numeric values from that chart

var p = new List<NxPage> { new NxPage { Height = 20, Width = 1 } };

can you explain me the above line of code.Correct me if I am wrong, as per my understanding Height == number of rows and width==number of columns. when I change width to 2 it give me two output but I want to get the second output only not both(data of 2nd column)

Øystein_Kolsrud
Employee
Employee

The NxPage structure defines a rectangle of cells from the table produced by the hypercube. The "Top" and "Left" properties indicates the top left corner of the rectangle, and the "Height" and "Width" properties indicates its size. If you only want the second column you should use the following page (columns are indexes from 0):

new NxPage { Top = 0, Left = 1, Height  = 20, Width = 1 };