Hello,
Follwing my support email, would it be possible to show how can we customize the functions when handling the data (from collection or rest API) please?
I am struggling a bit with String functions as “replace” doesn’t work as expected and I can’t find a way to concat 2 strings.
Just to let you know I created a function (addToString). It’s rather simple and answer to my specific need (adding URL to an image path).
Might add later a customizable concat function
Thanks for sharing this! It is indeed super powerful!
Quick question here … I added this as a “Plugin”:
mdFunctions.OnReady(() =>
{
mdFunctions.ItemAdd({
id: 'getNameOfDayFromIndex',
parameters: {
dayOfIndex: {type: 'INPUT', value: ''},
},
description: 'Get the ',
group: 'String',
function: function(data, value, dayOfIndex)
{
// Perform JS here on the 'value' (value - value that function get's, eg: text)
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
return `${days[dayOfIndex]} | ${dayOfIndex} | ${value}`
}
})
});
I am just trying to understand the parameters.
data is required and indeed has information in it. value, however, is reported as null, but the function breaks if it is not included as a parameter.
Are these just kind of always required and pass-in parameters for the other data points needed?
Also, what is the best way to import an external module/package. I would like to be able to use Day.js in plugins, but I could not find a way to import the code. Here is the link to their docs: Installation · Day.js