Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I would like to get the selected values of an app field using the .NET SDK.
Using the capability API, I can use the following code:
var app = qlik.openApp('55d31b81-55c5-4620-95f5-7d4b95faced9');
var genericObject = {
date: {
qStringExpression: '=GetFieldSelections([Datum performance])',
},
};
app.createGenericObject(genericObject, result => {
console.log(
`GetFieldSelections([Datum performance]) = ${result['date']}` );
});
Which outputs the correct selected value(s):
GetFieldSelections([Datum performance]) = 19/04/2024
However, I must move the logic from extension to a C# backend. I found very little documentation, but assume the following code should work.
var app = await location.AppAsync("55d31b81-55c5-4620-95f5-7d4b95faced9");
var date = await app.EvaluateAsync("=GetFieldSelections([Datum performance])");
_output.WriteLine($"GetFieldSelections([Datum performance]) = {date}");
However, this snippet outputs:
GetFieldSelections([Datum performance]) = -
Which means no fields are selected.
Removing the = sign before the expression did not help.
I also tried to get the selected values using the (GetAllFieldValues Method | Qlik Sense for developers Help) method, both by specifying the StateEnumType.SELECTED or testing the state when requesting all values, to no avail.
Can anybody please help me pointing out what I am doing wrong?
Thanks in advance,
Henk-Jan.
---
Update 13:03: Suddenly, the code using the capability API also returns -, so I assume the code I used in C# is correct, no further action required.