Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a question maybe @AdamSawyer or @Andre_Sostizzo can answer:
Is it possible with SSE to implement a function that returns a table with several rows and columns and receives scalar parameters?
I have already implemented a function that returns many rows and many columns, and I invoke it using LOAD * EXTENSION MySSEName.myFunctionName(). It works perfectly fine. However, I would like to pass scalar parameters to that function in order to set some filters. I don't need to pass a table.
From the Qlik Sense side, my function only accepts tables as parameters, either TABLENAME or TABLENAME{COL1,COL2...}. If I try to pass a scalar parameter like 10, it will say "Table 10 does not exist".
Worst case, I can pass my parameters as a table that contains one column per parameter, but that's not very clean.
Is there a better way?
Thank you for your help! 🙂
I don't think it's currently possible. I submitted this an idea several years ago but development on SSE stopped before it got implemented.
-Rob
Dear @rwunderlich ,
Do you happen to have a link to that idea on the ideation portal?
Just to give it a "thumbs up".
I'm not sure I submitted this one on the ideation portal, it may have been submitted in other lists. What I did submit to the portal was the idea to allow optional parameters.
Even though status is "on roadmap", my understanding is that SSE has been 'functionally stabilized" and there will be no enhancements.
-Rob
I will kind of reply to myself here just to leave it for future readers and also for Qlik Staff who might confirm or not what I think:
When you pass parameters to a Server-Side Extension, they are always passed to the SSE as stream of BundledRows (several BundledRows objects containing several Row objects inside). Even if you invoke it as MySSE.myFunction('TextParam1', 123, 456, 'TextParam2'). In this case, you will get a single BundledRows object with a single Row object inside with 4 Dual objects (4 "columns") inside. One "column" per parameter.
Unfortunately, with the LOAD * EXTENSION syntax you cannot use scalar parameters. You have to pass actual tables or columns and they will be passed to the function as a stream of BundledRows with Row objects inside. If you need to do something equivalent to
LOAD * EXTENSION MySSE.myFunction('TextParam1', 123, 456, 'TextParam2');
you'll need to do
TMP:
LOAD 'TextParam1' as A, 123 as B, 456 as C, 'TextParam2' as D AutoGenerate(1);
LOAD * EXTENSION MySSE.myFunction(TMP);
// We drop the table used for passing parameters
DROP TABLE TMP;
At least this is what I understood. I hope someone from Qlik can confirm it. I also created an idea for Qlik to implement the scalar parameters also for LOAD EXTENSION statements: https://ideation.qlik.com/app/#/case/343422