Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Am having problem with get Num value based on field name , am trying with this code using .net SDK
// Select the relevant values of the field
var theField = qsApp.GetField(fieldOfInterest); // passing multiple field name using for loop
theField.Select(filterValue.ToString());
var currentSelection = qsApp.GetExtendedCurrentSelection();
var largePage = new NxPage { Top = 0, Left = 0, Width = 10, Height = 100 };
IEnumerable<NxDataPage> pages = currentSelection.GetSelectedData(fieldOfInterest, new[] { largePage });
Here i can't pass multiple fieldOfInterest (Field name) and value , its working for single field name. please give me the solutions
What does the loop look like? And in what is the symptom you are seeing when it doesn't work?
Thanks for replaying Oystein Kolsrud,
Am using multiple filter
For example :
Filter name ="month,Employee" // two filter name
Filter values ="April,prasanna" // filter values (April for month, prasanna for employee name )
Here my code is
if (fileds != null)
{
for (int i = 0; i < fileds.Count(); i++) // for Filter field name
{
var fieldOfInterest = fileds.ToString();
for (int j = i; j < values.Count(); j++) // for Filter field value
{
string[] val = values
for (int k = 0; k < val.Count(); k++)
{
// Select the relevant values of the field
var theField = qsApp.GetField(fieldOfInterest);
theField.Select(val
var currentSelection = qsApp.GetExtendedCurrentSelection();
// Here am geting error when 2 time looping
var largePage = new NxPage { Top = 0, Left = 0, Width = 10, Height = 100 };
IEnumerable<NxDataPage> pages = currentSelection.GetSelectedData(fieldOfInterest, new[] { largePage });
}
}
}
}
in var currentSelection = qsApp.GetExtendedCurrentSelection(); line
getting error when 2nd time looping like "The given key was not present in the dictionary."
i think the Filter name not updated in currentSelection , so that getting error like that. please help to fix this issue.
Hmm... That looks like a bug in the API. That dictionary error should never bubble up from that method. Anyway, could it be that the two selections are mutually exclusive? So that the value "prasanna" is already excluded when the month "April" is selected? Or perhaps the value "prasanna" does not exist?
Anyway, possible workaround could be to check that the field is part of the "FieldNames" list of the currentSelection object before doing the "GetSelectedData".
Hi Oystein Kolsrud, thanks for replay,
if it possible can you share the code , am working around for this issue past one week.
Thanks
Prasanna A
I'm thinking something like this:
if (currentSelection.FieldNames.Contains(fieldOfInterest))
{
var largePage = new NxPage { Top = 0, Left = 0, Width = 10, Height = 100 };
IEnumerable<NxDataPage> pages = currentSelection.GetSelectedData(fieldOfInterest, new[] { largePage });
}
Is any possible to pass array list to FieldNames
No, that list reflects the fields for which Qlik Sense considers there to be a selection.
But now that I look at it more closely, those loops of yours look rather strange. Is the "values" variable really a comma separated list? If so, why do you loop on "values.Count()"? That would be a loop based on the number of characters in the string.
Why am using loop means , am having multiple field name and values , i want "qNum" value based on field name from qlik sense via qlik engine.
For example
1) Field name ["Month","Empname"] // 2 field name
2) values for month ["Jan","Feb","Dec"] // 3 values for field name month
3) values for Empname ["Emp1","Emp2"] // 3 values for field name month
now i want "qNum" values from qlik sense based on month values ["Jan","Feb","Dec"] , its like ["1","2","12"], this things am trying with loop. when i searched with google i got this link
Engine API select range in .NET application
i developed my concept based on this site. Now my problem is when try with single field name and values its working but in loop its not working.
Am looking solutions for last one week, am expecting your solutions for this one
And also some thing am trying with Qlik sense portal in Engine API Explore,
1) First am connect the app which i want.
2) Choose the Get Field method from the Doc Object.
3) Once Execute this query i got Get Field as Month
{
"handle": 1,
"method": "GetField",
"params": {
"qFieldName": "", // Give as Month
"qStateName": ""
}
}
4) in that i choose the Select values, as given below
{
"handle": 2,
"method": "SelectValues",
"params": {
"qFieldValues": [
{
"qText": "", // Select values as Jan
"qIsNumeric": false,
"qNumber": 0
}
],
"qToggleMode": false,
"qSoftLock": false
}
}
5) Finally i got result as
{
"handle": 2,
"method": "SelectValues",
"params": {
"qFieldValues": [
{
"qText": "Jan",
"qIsNumeric": false,
"qNumber": 0 // this value i want
}
],
"qToggleMode": false,
"qSoftLock": false
},
"outKey": -1,
"id": 4
}
This things am trying via qlik engine with c#.
Thanks