Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I want to access each and every graph inside qlik sense app by using .netSDK. I am new to c# If someone could help me with the sample code(easy to understand) that'll be great.
Hi
The QlikBot .NET code was released yesterday showing the .NET code
of how to use the APIs together with the Bots.
Think this is a good starting point to answer the question.
Looking in the QlikSenseEasy -> QSEasy.cs file
on what it is that you are specifically looking for
But basically its going to be something like
...
IApp app = qsLocation.App(myAppID)
then
app.GetMasterObjectList().Items?.Select(item => app.GetObject<MasterObject>(item.Info.Id));
and then convert that object to a respective sheet, chart, etc
Raun thanks for your prompt reply. Sinse I am new to c# as well as qlik sense if you could give me code example that would be great.
Hi
The code for all of it is a bit long (the QSEasy file is over 2000 lines) and I'm not sure what your specifically looking at.
Its a good idea to go through the QSEasy.cs file but basically make sure that
- you import the Qlik API's
- reference them with the using Qlik.Engine, Qlik.Sense, etc
- initiate the app
Read this article to connect/some extra info
Re: QlikSense Desktop Chat Bot
And then check the code for one of them like CreatePieChart
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).
From my understanding of the API's, how they are built is not so much to access an individual object and its data.
You should rather research how to create a hypercube with the same dimensions and measures,
which would replicate the data from that table.
It might be possible to extract the data from an object, I'm just not sure how to do this myself.
Still learning a lot here as well.
The best is to look at the QlikBot example.
IEnumerable<ISheet> sheets = qsApp.GetSheets();
foreach (ISheet sheet1 in sheets)
{
Console.WriteLine(sheet1.GetBarchart("qZPdytp")); #getbarchart requires object id
}
output in console is: Qlik.Sense.Client.Visualizations.Barchart
and also tell me what exactly hypercube class is used for and there are multiple hypercube classes in api which one to start with.
You can access the data of any Qlik object via its Hypercube. Here is how to get all of the sheet objects:
foreach (IGenericObject child in sheet.Children) {
Console.WriteLine("Type:{0} ID:{1}", child.Info.Type, child.Info.Id);
}
Once you have the objects, you can retrieve the paged data as so:
var first10RowsPage = new NxPage {
Top = 0, Left = 0, Width = myObject.HyperCube.Size.Cx, Height = 10
};
IEnumerable<NxDataPage> data = myObject.GetHyperCubeData(“/qHyperCubeDef”, new [] { first10RowsPage });
Please review our Help site for detailed documentation.
Thanks Todd but I already got this code on qlik website but I am not able to implement it.
Here is my code:
foreach (Qlik.Sense.Client.ISheet AppSheet in Qlik.Sense.Client.AppExtensions.GetSheets(qsApp)) | |||||||
{
|
}
}