-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling python functions in the data load editor #37
Comments
Hi @sagarkolte , Is there a reason you can't pass the list of selections with every SSE call? For e.g. store the list of selections in a Qlik variable and use that as one of the parameters for your SSE function calls. However, what you have asked should be doable: On the Qlik side you could have a variable that has a SSE function as the expression. This function should take in the list of selections as an argument. On the Python side you then need an object that retains it's state during multiple SSE calls. One option is to extend the If you are building a new class and define your SSE function as a And if you want the list to survive a restart of the SSE you'll need to save it to disk with something like joblib or pickle. Hope that helps. |
Hi Nabeel, “This function should take in the list of selections as an argument.” Can you please tell me how I store the selection of a drop down list into a variable? Thanks and Regards |
It depends on what you mean by a drop down list. If you're referring to a standard listbox and want to get selections from a field, there are standard Qlik functions such as GetFieldSelections or Concat. You'll find more details on these at the Qlik Help site. If you mean that you want a dropdown to control the value of a variable in your app, you would use an input control such as the Variable Input bundled extension. |
Thanks Nabeel, I will be trying this when I reach office. By the way, just for clarity’s sake to answer your question: “Is there a reason you can't pass the list of selections with every SSE call?” I can’t, as it takes 4 seconds for the function to run and I will end up making more than 400 calls to the function. Regards |
Hi @sagarkolte , just curious if those are 400 unique SSE calls? Is each call being made with a different set of data or parameters? I ask because if it's just the same call being made by multiple users, Qlik will cache the results and avoid unnecessary computation. |
Hi Nabeel, Regards |
Hi Nabeel, My python function accepts a list of strings and is supposed to return a table with two columns of type float. The intention here is for Qlik to plot a scatter plot using the two columns. But apparently we cannot return a table to Qlik. So I converted that table into a json string and passed it to Qlik. I then use the Subfield and TextBetween functions to parse the json string and get back the float values. Is there a better way to do this? Thanks. |
On your first question of the charts would just be waiting for the SSE response so performance improvements can only be made on the Python side. You can experiment with a single call and check that it is getting cached in Qlik. Make a set of selections and remove them, then make them again. The chart should render without a SSE call the second time. You can then add more calls and see if anything gets pushed out of the cache. On your second question, you're right that currently a SSE can't return a table to a chart object (it can in the load script though). Usually this should not be a problem in the frontend as each SSE call is made through a measure or dimension which is a single column rather than a table. But if you need to return a table, the workaround is what you did; concatenate the values in Python in some way and the parse them in Qlik using SubField. |
Hi Nabeel,
Thanks much! |
|
Hi Nabeel, Using GetFieldSelection like function in the load editor. For example in your qvf file you have the vHospital variable. You seem to have saved a static value in this variable. We would like to store the user selection in this variable. Thanks! |
Hi Nabeel, |
Hi Nabeel,
I have written a library of functions in Python which I am able to successfully call from Qlik sense. However I wish to achieve the following:
Given a list of selections by the user from a drop down menu in the app, I pass this list to my python function and save the output in a variable which I can use repeatedly. Could you please help me with some direction here? Thanks.
The text was updated successfully, but these errors were encountered: