Skip to content
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

Functions with a variable number of parameters #34

Open
nabeel-oz opened this issue May 30, 2018 · 5 comments
Open

Functions with a variable number of parameters #34

nabeel-oz opened this issue May 30, 2018 · 5 comments

Comments

@nabeel-oz
Copy link

nabeel-oz commented May 30, 2018

Description

Currently the examples don't cater for functions that take in a variable number of parameters. After working on my Python SSE project I find this to be a common requirement:

  • A function that takes in optional parameters
  • A function that can be run with a variable number of measures
  • A function that requires multiple data series as input

At the moment I can only see one workaround, which is to concatenate all the required parameters/ measures into a string in Qlik and pass it as a single parameter. The SSE then has to parse the string and extract the parameters/ measures. While I have got this working, a better implementation would make the solution more robust.

Things I'd really like to be considered are:

  • A new DataType and Qlik expression syntax to pass a list/array of Duals as a parameter.
  • A better way to pass key word arguments to a function.

I'm happy to discuss this further and show example use cases.

Environment

Operating system
[x] Windows
[x] Linux
Qlik Sense
[x] Desktop
[x] Server

Versions

  • server-side-extension: v1.1.0
  • Qlik Sense: April 2018
  • Operating system: Windows Server 2012 R2, Windows 10
  • Python 3.6
@josefinestal
Copy link
Contributor

josefinestal commented May 30, 2018

Hi @nabeel-qlik !
Thank you for your input and suggestions, we really appreciate it. We are aware of the limitations regarding the topics you mentioned, and they are all included in our backlog. However, we don't know when they will be included in a release. We will let you know as soon as we know.

Another workaround would be to define several SSE functions with the different set of parameters(optional/required), and which are all mapped to a single function on the plugin side.

Kind regards,
Josefine

@nabeel-oz
Copy link
Author

Hi @josefinestal , thanks for confirming that these enhancements are on the to-do list. I think they would greatly simplify the implementation of SSE functions and also the Qlik expressions needed for the current approach.

I have used the workaround you suggested as well, but that brings up another limitation that the function names exposed to Qlik must be unique. It only makes sense to use this workaround when the functions have distinctly different usage. It would be good if we can define one function name with several signatures and have the help syntax displayed similar to native Qlik expressions:

native qlik expression

@qlik-aoh
Copy link
Contributor

Hi @nabeel-qlik ,

Thanks for the feedback, we appreciate it!

For the use case of specifying a variable number of arguments to a function, I have sometimes used EvaluateScript as a routing mechanism, using the script variable to specify which function to call.

This allow expressions with different number of arguments , like p.ScriptEval('sum', a, b) and p.ScriptEval('sum', a, b, c, d).

This still has many limitations and is of course not as good as proper support for variadic functions, but it is a useful workaround in some situations.

Thanks,
Markus

@JensB123
Copy link

JensB123 commented Sep 9, 2022

Hi @josefinestal & @qlik-aoh,

Is the extension still under active development and if so, is the mentioned issue still in the backlog? Atm I face the same problems as @nabeel-oz.

Thanks in advance!

Jens

@countnazgul
Copy link

I know this is an old issue but just stumbled into the same question. And was wondering if there is an update on this topic.

Stefan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants