Skip to content
Advertisement

How to pass input from user to a java script function inside a snowflake UDF?

I have to convert some JS functions to snowflake udfs. It works successfully with hardcoded sample data but I can’t make it accept user input as arguments. I know the UDF’s create statement is supposed to take the input but I cannot make it work.

JavaScript

Thanks for the help.

Advertisement

Answer

Assuming that arguments to provide are inside map.set("SKU","Common Measurement (L x W)^Manufacturer Color/Finish"); the function signature has to be changed to findAndReplace(ARG1 TEXT, ARG2 TEXT):

JavaScript

Function all:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement