Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
tauceef
Partner - Contributor III
Partner - Contributor III

Nprinting API and OnDemandRequestFilters

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

Labels (2)
1 Solution

Accepted Solutions
tauceef
Partner - Contributor III
Partner - Contributor III
Author

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

View solution in original post

9 Replies
tauceef
Partner - Contributor III
Partner - Contributor III
Author

Hi @Ruggero_Piccoli

Replying to your post:

https://community.qlik.com/t5/Qlik-NPrinting-Discussions/NPrinting-REST-API-and-OnDemandRequestFilte...

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

Ruggero_Piccoli
Support
Support

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



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
tauceef
Partner - Contributor III
Partner - Contributor III
Author

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

Ruggero_Piccoli
Support
Support

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



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
tauceef
Partner - Contributor III
Partner - Contributor III
Author

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

sudeepkm_analog
Contributor III
Contributor III

@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.

Ruggero_Piccoli
Support
Support

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



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
tauceef
Partner - Contributor III
Partner - Contributor III
Author

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

tauceef
Partner - Contributor III
Partner - Contributor III
Author

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