You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use external moment.js lib without luck. Here is my code:
CREATE FUNCTION getWeek AS
``
function(x) {
let moment = global.get('moment');
return moment(x).week();
}
``;
SELECT
COUNT(*),
SUBSTRING(created_at,1,10) AS created_at,
getWeek(created_at)
FROM ?
GROUP BY SUBSTRING(created_at,1,10)
I failed also when tried to acceess msg object. Is there a way to resolve it?
EDITED:
As a workaround I used moment in function node before using alasql node so I can work with "ready" data.
let moment = global.get('moment');
for (let i = 0; i < msg.payload.length; i++) {
msg.payload[i].week = moment(msg.payload[i].created_at).week(),
msg.payload[i].month = moment(msg.payload[i].created_at).month(),
msg.payload[i].yaer = moment(msg.payload[i].created_at).year()
}
return msg;
The text was updated successfully, but these errors were encountered:
I'm trying to use external moment.js lib without luck. Here is my code:
I failed also when tried to acceess msg object. Is there a way to resolve it?
EDITED:
As a workaround I used moment in function node before using alasql node so I can work with "ready" data.
The text was updated successfully, but these errors were encountered: