I have a user defined function called GetPayLoad, which I defined in Tools -> Edit Module.
function GetPayLoad(jsonString, fieldName) {
if (jsonString) {
var json = eval('('+jsonString+')');
if (json.hasOwnProperty(fieldName)) {
return json[fieldName];
}
}
return null;
}
It works as expected.
Now I would like to export it to a text file so that I can reuse it in other applications. Therefore I exported the function to a txt file, inserted an include command in the script and tried to use the function during load.
RemoteTable:
LOAD
ad_uuid,
GetPayLoad(payload_json, 'fromMail') AS fromMail;
SQL SELECT
ad_uuid,
toJson(payload) AS payload_json
FROM ...;
Now I get the error
Unknown statement
function GetPayLoad(jsonString, fieldName) {
if (jsonString) {
var json = eval('('+jsonString+')')
Can anyone help me with that? Do I need to call the function separately somehow?