I am trying to insert values into MSSQL node. I input values from a form then click a submit button to insert the values to the database. The values come out in an object. I use the change nodes to parse each of those values out into single values, then use another change node to create them into global variables to reference them in a function node. Reasoning in me doing that is I don't want the function node to activate if I have multiple submit buttons on the form. I want everything tied to one button. However, when I try to insert the data I get an (Invalid column name Test1 and Test2) error. Those are my values I input not the individual object names. When I change the column names in the database to the column names listed in the debug it then throws the error that is can't find BatchNumber or WorkOrderNumber. Please help. Thanks.
This is also the function I am using to grab the global variables
It looks like if I remove the "SET" statements in my SQL insert I don't get an error but I also don't get data inserted i just get NULL values in the database
- Delete everything except the form node and SQL node & 2 debug nodes
- Connect the form to 1 debug and to SQL node
- Connect SQL output to 2nd debug
- Setup the SQL node to use parameters
- Enter test values into the form and submit (so you get form values in debug panel)
- Use the copy path from the debug msg to populate the parameters
There is no need for global context.
See this post for an example of how to do parameters
Copy path...
There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.
This worked thank you! Very well said.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.