Is there a list of the available input types somewhere so these can be included in an input definition?
This is from the inject node so I suspect it includes all the predefined ones.
Is there a list of the available input types somewhere so these can be included in an input definition?
This is from the inject node so I suspect it includes all the predefined ones.
Great thanks. Exactly what I am after.
It would be really good if these API docs were linked to from the Creating Nodes : Node-RED docs.
No doubt. I'm sure a PR that added such a link in the right place would be warmly received.
As it is related, I will ask it here. In the node I am working on, there is a function that obviously acts on the field input type selected.
I need to add several new options, but cannot see what the right code might be to do so.
I have guessed for num
, but not sure for jsonata
or env
(I have added the case
stubs).
Might the env entry simply be node.context().env.get(config[key]);
?
Have I missed something in the docs that explains this? Possibly I have misunderstood the purpose of this function completely .
function typedDataFactory(RED, config, node) {
return function getTypedInput(msg, key) {
const type = key + 'Type';
if (!config[type]) return config[key];
switch (config[type]) {
case 'str':
return config[key];
case 'date':
return new Date();
case 'msg':
return RED.util.getObjectProperty(msg, config[key]);
case 'flow':
return node.context().flow.get(config[key]);
case 'global':
return node.context().global.get(config[key]);
case 'num':
return config[key];
case 'jsonata':
case 'env':
default:
break;
}
}
}
For all of the built-in types you can use RED.util.evaluateNodeProperty
Thanks.
This node originates a long time ago so perhaps that wasn't a thing when it was first written.
Is there anything in the docs on how to use this? (Just realised the docs are not searchable).
No, this isn't currently explicitly documented other than by example in the core nodes.
Ok, thanks.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.