Detect link in nodes with a function node

Hello,

I want to find out all "link in" nodes in a function node.
Unfortunately, the function RED.nodes.filterNodes({ type: "link in" }) is not available in the function node. Is there any other way to identify the link in nodes?

I have defined numerous test cases in Node-RED, which are started individually via a "link in" node.

Now I would like to create a summary test, which dynamically detects all test cases and processes them sequentially.

This flow will identify the link in nodes and output a sequence of messages, one per instance.

[{"id":"e07445aa.50d4e","type":"inject","z":"2f7c2f6d.c20a68","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":460,"wires":[["7d30d17a.7a26"]]},{"id":"7d30d17a.7a26","type":"http request","z":"2f7c2f6d.c20a68","name":"GET flows","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://localhost:1880/flows","tls":"","persist":false,"proxy":"","authType":"","x":370,"y":460,"wires":[["8cb7dc90.4a0728"]],"info":"Get list (array) of all tabs and nodes.\n"},{"id":"8cb7dc90.4a0728","type":"split","z":"2f7c2f6d.c20a68","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":510,"y":460,"wires":[["6d96df9b.613578"]]},{"id":"6d96df9b.613578","type":"switch","z":"2f7c2f6d.c20a68","name":"type","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"link in","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":630,"y":460,"wires":[["57e0b751.0cac4"]]},{"id":"57e0b751.0cac4","type":"debug","z":"2f7c2f6d.c20a68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":460,"wires":[]}]

Not as neat as having it all in a function node, but it might serve.

1 Like

Thank you for your example flow. It is not an ideal solution, but I can live with it very well :wink: Thank you very much.

Maybe the link call node will be extended in the future, so that the link in nodes can be detected to make the dynamic link even more dynamic :wink:

You're welcome.

Not exactly sure what you mean here. If you want the target of the link call to know which node "called" it, you can add a property (for example, msg.source) to the message being passed.

I wanted to suggest that the node is supplemented to list all link in nodes. In itself the same as your example flow only without API access.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.