Change data in inject

Hello, sorry if this does not go here, but I am very new to this.

I have a doubt that I have not been able to solve by myself.

I have an inject to a "socketcan -in" as I show in the attachment.

that inject sends this json

    "ext": false,
    "rtr": false,
    "canid": 123,
    "dlc": 5,
    "data": [

My question is. if I can individually vary the values ​​of "data" (1,2,3,4,5 ...) from a text box or similar and send it modified to the socketcan.

Thanks in advanced!

Of course you can, but you need to use numeric or text input node―or whatever suits your requirement: "individually vary the values"―in the dashboard.

Replace your inject with change and use a JSONata expression to merge the user-provided values accordingly into the JSON you require.

If you have a lot of numbers to input (or maybe a variable number of inputs) and need to create form for them, you can also use the ui-template Dashboard node and use the features of the underlying Angular framework. ng-repeat will let you dynamically build any HTML/Angular structure including multiple input boxes.

Alternatively, you could us a single textbox input and collect the numbers as a string then parse that string either using a function node or a change node with the JSONata split function.


JSONata in a change node:

$split(payload, ',')

Which should return an array from the original string.

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