server-side-extension icon indicating copy to clipboard operation
server-side-extension copied to clipboard

Functions with a variable number of parameters

Open nabeel-oz opened this issue 7 years ago • 5 comments

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

nabeel-oz avatar May 30 '18 02:05 nabeel-oz

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

josefinestal avatar May 30 '18 08:05 josefinestal

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

nabeel-oz avatar May 31 '18 04:05 nabeel-oz

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

qlik-aoh avatar May 31 '18 07:05 qlik-aoh

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

JensB123 avatar Sep 09 '22 07:09 JensB123

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

countnazgul avatar Apr 19 '23 08:04 countnazgul