Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

berndpodhradsky
New Contributor II

Retrieve Column Headers

Hi!

I'm using the .NET SDK API and trying to retrieve all columns of a Table object. I'm aware of the ColumnOrder property, but which property do I need to access with these indices to get the column header labels?

Thanks,

Bernd

4 Replies
Employee
Employee

Re: Retrieve Column Headers

I'm no expert in the .Net SDK what so ever so excuse any errors on my part

But speaking from a Generic Object spec point of view, the column headers are your labels defined in qDimensionInfo and qMeasureInfo. Then you match those against your ColumnOrder, i.e your dimensions and measure are defined and then column order defines sort and display order.

If you are interested in what's returned you can look at http://help.qlik.com/en-US/sense-developer/2.2/Subsystems/EngineAPI/Content/GenericObject/LayoutLeve...

So no .Net help but maybe you can work your way back from the HyperCube layout to a matching .Net SDK property

berndpodhradsky
New Contributor II

Re: Retrieve Column Headers

Hi!

Thanks for your reply. I tried to go that way, but how can I actually do that? The ColumnOrder returns an array (for instance {0, 1}). Dimensions and Measures are two collections - how do I know which index belongs to which collection? Is ColumnOrder "0" a dimension or a measure?

Bernd

Luminary
Luminary

Re: Retrieve Column Headers

Hi Bernd,

here some code snipets from my .NET Code:

ll = genericSessionObject.GetLayout() as TableLayout;

headerNames = (from c in ll.HyperCube.DimensionInfo select new HeaderItem() { Name = c.FallbackTitle, Dimension = true }).ToList();

headerNames.AddRange(from c in ll.HyperCube.MeasureInfo select new HeaderItem() { Name = c.FallbackTitle, Dimension = false })

;

You will receive the Data in the same order and you can use the columnsortorder to reassign that for the display of the data.

bye Konrad

Luminary
Luminary

Re: Retrieve Column Headers

Hi Bernd,

you have to take care. The columnsortorder can be also NULL this meas: array {0..n-1} = {0},{1},...{n}

The columnsortorder it over Dimensions and Measures, like I did this in my code. The first columns are

the dimensions and the later one the measures. Just try it out you will see it in the result.

bye Konrad

Community Browser