# \[ANNOUNCE\] Visual programming a function node with Blockly - Feedback request

**URL:** <https://discourse.nodered.org/t/announce-visual-programming-a-function-node-with-blockly-feedback-request/1566>\
**Category:** Share Your Nodes\
**Created:** [13 July 2018 22:33 UTC](https://discourse.nodered.org/t/announce-visual-programming-a-function-node-with-blockly-feedback-request/1566 "2018-07-13T22:33:30Z")\
**Posts on this page:** 1\
**Showing post:** 130

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [16 August 2018 21:07 UTC](https://discourse.nodered.org/t/announce-visual-programming-a-function-node-with-blockly-feedback-request/1566/130 "2018-08-16T21:07:27Z")

</div>

Damn again... I have currently a loop inside the code generator, to _ **build the node.send statement** _:

```auto
    // Send the message only to the specified output number, and null to all other outputs.
    var outputArray = '';
    for (var i = 1; i <= Blockly.nodeOutputs; i++) {
        if (i > 1) {
            outputArray += `, `;
        }
        
        if (i == outputNumber) {
            outputArray += `${inputValue}`;
        }
        else {
            outputArray += `null`;
        }
    }
    
    var code = `if(${functionName}(${outputNumber})) {\n`;
    code += ` node.send([${outputArray}]);\n`;
    code += `}\n`;

```

But since I don't know anymore at code-generation-time which output number will be used (since that is only determined at run-time), this means I have to put the above loop also in the generated Javascript. This will result in unreadable code. Don't like that. It should stay in the code generator, and be invisible to the users.

Isn't it better that we don't allow the output number to be generated at runtime. I.e. **only allow a fixed number to be entered**. _ **The logic to determine which output needs to be used shouldn't be INSIDE the output\_number input field, but instead AROUND our send-block** _. For example by using an if-block:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/ffbc70fd15a43f087e634236c02fdc924a7450e0.png)

Otherwise nobody will understand the generated code anymore. Does this makes sense?  
@TotallyInformation: Julian, would be nice to get your opinion. And also other users ...

---

_[View the full topic](https://discourse.nodered.org/t/announce-visual-programming-a-function-node-with-blockly-feedback-request/1566)._
