Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Mikael_F
Contributor II
Contributor II

Making selections in multiple fields at the same time using API?

I have created an extension that allows my users to make selections in an app based on inputs into an Input-field, where they input a string like this: "Dim1:value1|value2|....|valueN;Dim2:value1|value2|....|valueN;....;DimN:value1|value2|....|valueN".

I do this now by splitting the string and looping through each Dimension and values. And that works, but each selection is made one at a time and it can be a little slow if we have a large app and there are many selections to be made. I would rather have a functionality that makes these selections as a "batch", i.e. all at the same time like what happens when you apply a bookmark. One way I thought of doing this would be to create a bookmark with the selections, but it only seems like it is possible to create bookmarks with the current selections in the app..

I spent a few hours now searching for a solution for this, but I'm not sure if it is possible at all. Does anyone know if there is any way to do this?

 

Thanks!

Best regards,

Mikael_F

Labels (2)
1 Solution

Accepted Solutions
alex_colombo
Employee
Employee

Hi @Mikael_F there is no way of sending selections as batch, or to be more precise, there is no API methods for doing this. My suggestion is to use selectValues method for each field-values. If you will not wait for the promise response from the method, your code will execute all the calls immidiateley.
Could you please describe better what you mean with "but each selection is made one at a time and it can be a little slow" and share your code?

View solution in original post

2 Replies
alex_colombo
Employee
Employee

Hi @Mikael_F there is no way of sending selections as batch, or to be more precise, there is no API methods for doing this. My suggestion is to use selectValues method for each field-values. If you will not wait for the promise response from the method, your code will execute all the calls immidiateley.
Could you please describe better what you mean with "but each selection is made one at a time and it can be a little slow" and share your code?

Mikael_F
Contributor II
Contributor II
Author

Hi @alex_colombo, thanks for your answer!

As I suspected, there is no way for me to do what I want using the API. Thanks for letting me know, so that I can stop looking :). 

Regarding my code, I did actually wait for the promise response in my code. (I'm not a very good JavaScript developer - yet ;).) When I re-wrote my code a bit, and removed the "await" keyword in front of the function call, the selections happened much faster! I have yet to try the extension in a big app, but if it's this method is this fast there as well then it will absolutely work :).

Thanks a lot!

Best regards,

Mikael_F