Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

prasannappt
New Contributor II

How to get Field using .net sdk

Hi All,

    Am new to qlik sense using .net sdk , i want get field Num(value) based on field name in c#. How to achieve this , please help me

Thanks

Prasanna A

1 Solution

Accepted Solutions
Employee
Employee

Re: How to get Field using .net sdk

There's a GetData method that takes a page set as well:

https://help.qlik.com/en-US/sense-developer/February2018/apis/net+sdk/html/M_Qlik_Engine_DataPager_G...

There's an example on how to use it available here:

https://github.com/kolsrud/qlik-dot-net-sdk-hypercube-usage/blob/master/HypercubeUsage/Program.cs#L2...

So if you only want the first two entries you would do something like this:

var page = new [] {new NxPage { Height = 2}};

var data = appField.ListObjectPager.GetData(page);

4 Replies
Employee
Employee

Re: How to get Field using .net sdk

Typically one would the the AppField class for that. Once you have an instance of that class you can either use it's GetData method or traverse it's data through the ListObjectPager property. I would have gone with the second option, in which case it would look something like this:

var appField = app.GetAppField("myfield");

var data = appField.ListObjectPager.GetData();

You can find more information about AppField class here:

https://help.qlik.com/en-US/sense-developer/February2018/Subsystems/NetSDKAPI/Content/WorkWith/Net-S...

And more information about how to work with the pager class can be found here:

https://help.qlik.com/en-US/sense-developer/February2018/Subsystems/NetSDKAPI/Content/HowTos/Net-Sdk...

prasannappt
New Contributor II

Re: How to get Field using .net sdk

Thanks for Replay Oystein Kolsrud,

            In my case,

  1. var appField = app.GetAppField("Month");  // month my field name
  2. var data = appField.ListObjectPager.GetData();  // data will return 12 months

here am passing "Month" as field name , data will return 12 month like (Jan, Feb, Mar,.... Dec) , Its possible to pass specific months like (Jan,Feb) only 2 months instead of 12 months.

Thanks

Employee
Employee

Re: How to get Field using .net sdk

There's a GetData method that takes a page set as well:

https://help.qlik.com/en-US/sense-developer/February2018/apis/net+sdk/html/M_Qlik_Engine_DataPager_G...

There's an example on how to use it available here:

https://github.com/kolsrud/qlik-dot-net-sdk-hypercube-usage/blob/master/HypercubeUsage/Program.cs#L2...

So if you only want the first two entries you would do something like this:

var page = new [] {new NxPage { Height = 2}};

var data = appField.ListObjectPager.GetData(page);

prasannappt
New Contributor II

Re: How to get Field using .net sdk

Thank you ... you saved my time lot.

Community Browser