Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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);
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));
}
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.
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);