Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How Create a HyperCube in .Net SDK

Hello,

Hello I am developing an app in .Net and would like to access data on Qlik Sense.

I managed to create the connection to the Qlik Engime however I am unable to create HyperCube and read the results as I do in JavaScript.

Can anyone help me with some example of HyperCubo creation and your reading?

Att.

11 Replies
reddy-s
Master II
Master II

Hi Thiago,

Check this out:

Creating dimensions and measures

There are two ways of creating Dimensionsand Measures:

  • Locally in the generic object.
  • Added to the application library for reuse in other generic objects.

Example: Create a local or inline Dimensions

   var myInlineDimension = new HyperCubeDimensionqDef { FieldDefs = new[] { "myDimension" } };

Example: Create an application or library Dimensions

   var myLibraryDimension = application.CreateDimension(); myLibraryDimension.SuspendLayout(); myLibraryDimension.Properties.Dim.FieldDefs = new[] {"myDimension"}; myLibraryDimension.ResumeLayout();

Example: Create a local or inline measure

   var myInlineMeasure = new HyperCubeMeasureqDef {Def = "=Sum(value)"};

Example: Create an application or library Measures

   var myLibraryMeasure = application.CreateMeasure(); myLibraryMeasure.SuspendLayout(); myLibraryMeasure.Properties.Measure.Def = "=Sum(value)"; myLibraryMeasure.ResumeLayout();

Adding dimensions and measures to the hypercube

When you have created your Dimensions and Measures you can add them to the hypercube.

Example: Add a Dimension to the hypercube

  cubeDef.Dimensions = new List<HyperCubeDimensionDef> { new HyperCubeDimensionDef {Def = myInlineDimension}, new HyperCubeDimensionDef {LibraryId = myLibraryDimension.Info.Id} };

Example: Add a Measures to the hypercube

  cubeDef.Measures = new List<HyperCubeMeasureDef> { new HyperCubeMeasureDef {Def = myInlineMeasure}, new HyperCubeMeasureDef {LibraryId = myLibraryMeasure.Info.Id} };

Thanks and Regards,

Sangram Reddy.

Not applicable
Author

Hello Sangram.

Thanks for the help, but I'm actually quite confused on how to read the HyperCubo data that was generated.

I am finding no such practice on the subject. When I read the HyperCube in JS is much more direct.

reddy-s
Master II
Master II

Hi Thiago,

Yes, the hypercube is straight forward while using Javascript.

But by following the above process you should be able to replicate the same , but in a bit more tedious process.

Øystein_Kolsrud
Employee
Employee

We recommend that you use the HyperCubePager‌ class to read data from hypercubes. You can get objects of this class by using one of the methods GenericObject.GetHyperCubePager ‌or GenericObject.GetAllHyperCubePagers.

In addition, Qlik Sense client objects usually have shortcuts directly from the object to a pager object for the hypercube of the client object. An example of this is the property Barchart.HyperCubePager ‌of the Barchart class.

You can read more about how to navigate through data in a hypercube or list object on this site:

Retrieving Data

Please let me know if this is what you are looking fore!

Best regards,

Øystein Kolsrud

Not applicable
Author

Thanks for the help, I can now read the hypercube data and my development is complete

Thanks for all the help.

Øystein_Kolsrud
Employee
Employee

Can you please mark the relevant answers as helpful and/or in this correct? It makes it easier for others to quickly identify what solution to go for if they have similar questions.

Thanks!

Best regards,

Øystein Kolsrud

tts
Employee
Employee

Hi,

Please take a look at my tweet.

[How to create HyperCube object via Qlik Sense Engine Service(QES) with Qlik Sense .NET SDK]

https://twitter.com/ttdummy/status/714992370069151744

[Sample Code]

-------

      var myDimension = new HyperCubeDimensionqDef
      {
        FieldDefs = new[] { "Country" }
      };
      var myMeasure = new HyperCubeMeasureqDef
      {
        Def = "Sum([Sales Amount]) / Sum([Budget Amount])"
      };
      HyperCubeDef myCubeDef = new HyperCubeDef();
      myCubeDef.Dimensions = new List<HyperCubeDimensionDef> {
        new HyperCubeDimensionDef {Def = myDimension}
      };
      myCubeDef.Measures = new List<HyperCubeMeasureDef> {
        new HyperCubeMeasureDef {Def = myMeasure}
      };
      myCubeDef.InitialDataFetch = new List<NxPage> {
        new NxPage {Height=20, Width=5}
      };

      GenericObjectProperties gp = new GenericObjectProperties();
      gp.Info = new NxInfo();
      gp.Info.Type = "hypercube";
      gp.Set<HyperCubeDef>("qHyperCubeDef", myCubeDef);
      GenericObject obj = app.CreateGenericSessionObject(gp);

-------

Not applicable
Author

Hi Takahashi

You helped me get to evolve with my need

Thanks!

tts
Employee
Employee

Hi,
Please see also my another tweet.
[How to create ListObject via Qlik Sense Engine Service(QES) with Qlik Sense .NET SDK]
https://twitter.com/ttdummy/status/715393122507706370

[Sample Code]
-------
      ListObjectDef myListDef = new ListObjectDef();
      myListDef.Def = new NxInlineDimensionDef {
        FieldDefs = new[] { "Country" }
      };
      myListDef.InitialDataFetch = new List<NxPage> {
        new NxPage {Height=20, Width=1}
      };
      myListDef.FrequencyMode = NxFrequencyMode.NX_FREQUENCY_VALUE;
      GenericObjectProperties gp = new GenericObjectProperties();
      gp.Info = new NxInfo();
      gp.Info.Type = "listobject";
      gp.Set<ListObjectDef>("qListObjectDef", myListDef);

      GenericObject obj = app.CreateGenericSessionObject(gp);
-------