bktag
August 10, 2023, 2:03pm
1
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.
Thank you in advance.
dejan
August 10, 2023, 2:28pm
2
Hello @bktag
This would require building a plugin
You would be actually first one who will do it, here’s how:
Install Creator application
From sidebar, open creator, then create new plugin, name it ‘Custom Replace’ or something similar.
Create your first javascript file (name it replace.js or something similar)
Paste this code
mdFunctions.OnReady(() =>
{
mdFunctions.ItemAdd({
id: 'my-replace',
parameters: {
pattern: {type: 'INPUT'},
keyword: {type: 'INPUT'},
},
description: 'Replace pattern with keyword.',
group: 'String',
function: function(data, value, pattern, keyword)
{
if(typeof value !== 'string')
{
return value;
}
// Perform JS here on the 'value' (value - value that function get's, eg: text)
return 'this is new replaced value';
}
})
});
Save and then refresh the website. You will then see this function to select as well named, ‘my-replace’
Let me know if you had any success.
In this way you can build plugins and publish to marketplace
bktag
August 10, 2023, 2:42pm
3
That looks cool! Will have a try and let you know
bktag
August 11, 2023, 8:53am
4
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
dejan
August 11, 2023, 2:21pm
5
@bktag
So everything works fine?
We will be releasing documentation in coming months, so you will have ability to extend/modify entire builder. It’s very powerful
1 Like
bktag
August 11, 2023, 5:57pm
6
Yes it worked! Thanks!
And indeed, Divhunt looks quite powerful! You guys will have a lot of work to do to document all the possibilities