Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
shubh_priyam
Contributor
Contributor

How To Make selection / set filter in Qlik Sense App via .NET SDK

 

 

Id

Employee Name

Manager Name

1

Rick

Alan

2

Tom

Louis

3

Harry

Alan

4

Joel

Philip

5

Austin

Alan

Hello,

This is the structure of my table in Qlik sense, I want to fetch rows  data on basis of column value.

like where "Manager Name==Alan"  fetch that row.

How can i do this in Qlik sense .Net Sdk.

as of now i am using this code

var cellsPage = new NxPage { Top = 0, Height = 5, Left = 0, Width = 2 };
                                IEnumerable<NxDataPage> pages = genericObject.GetHyperCubeData("/qHyperCubeDef", (new[] { cellsPage }));
                                var rows = pages.FirstOrDefault().Matrix;

 to fetch data but through this i am not able to fetch targeted row

Labels (4)
1 Solution

Accepted Solutions
yko
Employee
Employee

Are you sure you didn't just make a typo in the path to the cube? The main benefit of using a pager object is that you won't have to worry about doing the paging yourself. You can just access it as if it were a stream. You can try doing something like this instead to avoid manually entering the path:

var pager = o.GetAllHyperCubePagers().First();
var employeeNames = pager.GetAllData().Select(row => row[1].Text);

View solution in original post

3 Replies
yko
Employee
Employee

There are several ways to perform selections through the APIs in Qlik Sense. The simplest one, that is sufficient at least in your small example, is to go directly on the field. Here is an example of how to get the names of all employees whose manager is named "Alan":

using (var app = location.App(appId))
{
    var o = app.GetGenericObject(objectId);
    var field = app.GetField("Manager Name");
    field.Select("Alan");
    var pager = o.GetHyperCubePager("/qHyperCubeDef");
    var employeeNames = pager.GetAllData().Select(row => row[1].Text);
    Console.WriteLine(string.Join(", ", employeeNames));
}

 

shubh_priyam
Contributor
Contributor
Author

var field = application.GetField("Manager Name");
field.Select("Alan");
var cellsPage = new NxPage { Top = 0, Height = 3, Left = 0, Width = 3 };
IEnumerable<NxDataPage> pages = genericObject.GetHyperCubeData("/qHyperCubeDef", (new[] { cellsPage }));
                               

 Now i am able to select field but i can't fetch value using GetHyperCubePager and GetAllData it's returning null.

but using  above code i'm getting value , is there any alternative to this so i don't have to give height of row as in (thousands of line/row  data) i will not provide height.

yko
Employee
Employee

Are you sure you didn't just make a typo in the path to the cube? The main benefit of using a pager object is that you won't have to worry about doing the paging yourself. You can just access it as if it were a stream. You can try doing something like this instead to avoid manually entering the path:

var pager = o.GetAllHyperCubePagers().First();
var employeeNames = pager.GetAllData().Select(row => row[1].Text);

View solution in original post