Creating a calculated column function from the UI

Hi Team

Is it possible to create a calculated column function using the DG UI only?
Or is that requiring a file-based package?

Thanks

Yes, you can use

grok.functions.register({
  signature: 'String jsConcat(int foo, int bar)',
  run: (foo, bar) => `${foo}_${bar}`
});

Or, create a script (it can be written on Javascript)

Thanks. But where would I execute this registration call?

Regarding using a script, you mean to execute the function registration?

I think it’s the best way to create a script, and then use it as a regular function.

In the context panel you can find Links... button, that’s how you get script full name to use it.

Will the function - registered by a script execution - survive a Datagrok server update or would I need to re-execute the script to register the function again?

Script lives in DB, yes, it will survive DG update.

But if you register a function with JS snippet – it doesn’t survive window refresh.

1 Like

So the only way to “persist” the function and share with others would be via a package?

It seems like I cannot get the function to the calculated column dialog that way?
How would I do that?

You can create a script. You can share it, and it persists.
You can use it in formulas like NPulver:MyScript1

Would be great if we could follow-up in a quick meeting (send you a Teams message)