Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Has anyone used OnDemandRequestFilters JSON object? I tried multiple ways:
{\"filters\": { \"additionalFilters\" : [ { \"ColumnName: value\" } ] } }
{\"filters\" : { \"additionalFilters\" : [ { \"ColumnName\": \"value\" } ] } } with this syntax request is getting failed.
{\"filters\" : { \"additionalFilters\" : [ {\"Nprinting filter ID\" } ] } } filter ID like "xxxxxxxx-a922-4135-aaad-xxxxxxxx"
but nothing works. looking forward for help from the experts.
Additional Info: we are trying to implement on-demand report generation from mashup portal in .net code. I am able to create the session and on-demand request, report is also getting generated (downloading all data) but we are stuck at passing filter value(s). I tried to pass the filter value selected in mashup using "selections" property but that didn't worked after that trying to use "filters" that is also not working.
Please let me know if any more details required.
Regards,
Tauceef
Just now tried for multiple filters and this is how it works:
string json = "{\"type\":\"report\"," + "\"config\": {\"reportId\":\"" + xxxxxxxx-a922-4135-aaad-xxxxxxxxxxxx + "\",\"outputformat\":\"xlsx\"},\"selections\":[{\"fieldName\":\"" + allFieldSelections.fieldName + "\",\"selectedValues\":[\"" + allFieldSelections.selectedValues[0].qName + "\"],"+ "\"fieldName\":\"Field2\",\"selectedValues\":[\"Value1\",\"Value2\"]}],\"connectionId\":\"" + xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + "\"}";
Regards,
Tauceef
Replying to your post:
would you please explain more on this
"In the additionalFilters parameter of OnDemandRequestFilters you must insert the ID of existing Qlik NPrinting filtrers in the app you are using."
In the 3rd point mentioned above I have already tried passing filter ID using syntax shared above but it is not working for me.
Regards,
Tauceef
Hi,
You must create the filter, for example by using the Web Console. After storing the filter in the Repository it will have a unique ID and you must insert that ID in the parameter. The filter must be related to the same app of the report you are requesting.
Best Regards,
Ruggero
Hi Ruggero,
Exactly what we are doing but it's not working for us, report is getting downloaded with all data.
I tried "OnDemandRequest.selections" as well but that also is not working, all data is getting downloaded. below is the JSON code what we have used, if you could review and share your comments:
string json = "{\"type\" : \"report\"," +
"\"config\" : { \"reportId\" : \"xxxxxxxx-a922-4135-aaad-xxxxxxxxxxxx\",
\"outputformat\" : \"xlsx\"},
\"selections\" : [ { \"fieldName\" : \"Client\",
\"selectedValues\" : [ { \"Clientname\" } ]
} ]
}";
Regards,
Tauceef
Hi,
Test by adding all fields in FieldSelection. Refer to https://help.qlik.com/en-US/nprinting/June2019/APIs/NP+API/index.html?page=76
If this doesn't solve please open a support ticket.
Best Regards,
Ruggero
Hi Ruggero,
Thanks for your support and assistance, I have logged a case hope to get the solution soon.
will post if I get any solution.
Regards,
Tauceef
@tauceef Any luck? I'm trying to run a report with Filter and unable to do so.
Also I'm able to create a filter through API Call but the Values are not getting added.
Please let me know in case you have found a solution. Thanks.
Hi,
For other reades the answer is https://community.qlik.com/t5/Qlik-NPrinting-Discussions/NPrinting-API-POST-method-Create-new-filter...
Best Regards,
Ruggero
Not sure if you got the solution but this is how we finally got it worked:
string json = "{\"type\":\"report\"," + "\"config\": {\"reportId\":\"" + xxxxxxxx-a922-4135-aaad-xxxxxxxxxxxx + "\",\"outputformat\":\"xlsx\"},\"selections\":[{\"fieldName\":\"" + allFieldSelections.fieldName + "\",\"selectedValues\":[\"" + allFieldSelections.selectedValues[0].qName + "\"]}],\"connectionId\":\"" + xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + "\"}";
This is working if you have only one filter value to pass. Currently I am looking to pass multiple filters and that too with multiple values for a filter but no luck yet, if anyone have any solution please do suggest. I will post if anything works out.
Regards,
Tauceef
Just now tried for multiple filters and this is how it works:
string json = "{\"type\":\"report\"," + "\"config\": {\"reportId\":\"" + xxxxxxxx-a922-4135-aaad-xxxxxxxxxxxx + "\",\"outputformat\":\"xlsx\"},\"selections\":[{\"fieldName\":\"" + allFieldSelections.fieldName + "\",\"selectedValues\":[\"" + allFieldSelections.selectedValues[0].qName + "\"],"+ "\"fieldName\":\"Field2\",\"selectedValues\":[\"Value1\",\"Value2\"]}],\"connectionId\":\"" + xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + "\"}";
Regards,
Tauceef