Wrong data with form node

I have a form node to insert a Date and other two string data.
The problem is that an incorrect data is saved on my SQL database and shown on a table in the UI.

This is the flow (part of a complex flow):

[{"id":"5a6581d01a879e1c","type":"ui_form","z":"2380dbebb998c1d1","name":"","label":"","group":"2406fc0b6515765c","order":2,"width":6,"height":1,"options":[{"label":"DATA ULTIMO CONTROLLO","value":"DATAULTIMOCONTROLLO","type":"date","required":true,"rows":null},{"label":"RESPONSABILE","value":"RESPONSABILE","type":"text","required":true,"rows":null},{"label":"NOTE","value":"NOTE","type":"text","required":false,"rows":null}],"formValue":{"DATAULTIMOCONTROLLO":"","RESPONSABILE":"","NOTE":""},"payload":"","submit":"INVIA","cancel":"CANCEL","topic":"topic2","topicType":"str","splitLayout":"","className":"","x":630,"y":1020,"wires":[["73dfefc9e70f4fcf","cda5ffc0469aaf2b"]]},{"id":"a4ac4493082bb7f8","type":"MSSQL","z":"2380dbebb998c1d1","mssqlCN":"6fb70e68d89e36c4","name":"","outField":"payload","returnType":"0","throwErrors":"0","query":"INSERT INTO [DB_Strumentazione].[dbo].[SCADENZIARIO]\n(ID_STRUM,DATAULTIMOCONTROLLO,RESPONSABILE,NOTE) \nVALUES (@ID_STRUM, @DATAULTIMOCONTROLLO,@RESPONSABILE,@NOTE)","modeOpt":"","modeOptType":"query","queryOpt":"","queryOptType":"editor","paramsOpt":"","paramsOptType":"editor","rows":"","rowsType":"msg","params":[{"output":false,"name":"DATAULTIMOCONTROLLO","type":"VarChar","valueType":"msg","value":"payload.topic2.DATAULTIMOCONTROLLO","options":{"nullable":true,"primary":false,"identity":false,"readOnly":false}},{"output":false,"name":"RESPONSABILE","type":"VarChar","valueType":"msg","value":"payload.topic2.RESPONSABILE","options":{"nullable":true,"primary":false,"identity":false,"readOnly":false}},{"output":false,"name":"NOTE","type":"VarChar","valueType":"msg","value":"payload.topic2.NOTE","options":{"nullable":true,"primary":false,"identity":false,"readOnly":false}},{"output":false,"name":"ID_STRUM","type":"int","valueType":"msg","value":"payload.topic1[0].ID","options":{"nullable":true,"primary":false,"identity":false,"readOnly":false}}],"x":1040,"y":1080,"wires":[[]]},{"id":"73dfefc9e70f4fcf","type":"debug","z":"2380dbebb998c1d1","name":"Form Out","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":880,"y":1180,"wires":[]},{"id":"cda5ffc0469aaf2b","type":"join","z":"2380dbebb998c1d1","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":810,"y":1020,"wires":[["a4ac4493082bb7f8","749be14a50ba83e5","227b492266f8cb1c"]]},{"id":"2406fc0b6515765c","type":"ui_group","name":"Inserimento data controllo","tab":"21286fd2ee7bdc0c","order":7,"disp":true,"width":"10","collapse":false,"className":""},{"id":"6fb70e68d89e36c4","type":"MSSQL-CN","name":"DB_Strumentazione","server":"GIOVANNAQ\\SQLEXPRESS","port":"","encyption":true,"trustServerCertificate":true,"database":"DB_Strumentazione","useUTC":true,"connectTimeout":"","requestTimeout":"","cancelTimeout":"","pool":"","parseJSON":false,"enableArithAbort":true},{"id":"21286fd2ee7bdc0c","type":"ui_tab","name":"Inserimento Date Controllo","icon":"assignment","order":5,"disabled":false,"hidden":true}]

The output of the form node is joined with another output.

I have seen other post, but I didn't find a function which solved my problem.

Is there a way to add +1 (day) when I insert Date on the SQL table?

Thanks for your help

There is not enough information to help you.

What data? How is it incorrect?

Screenshot? what should it be?

What output?

What post?

What is the problem?

Yes, use the DATEADD SQL function

Incorrect Date (not data).
I insert 26/04/2022 in the form node, and 2022-04-25T00:00:00.000Z is saved.

I would like to add 1 day in the SQL node where I put the input DATAULTIMOCONTROLLO. Is it possible?

I see you have set the field type of DATAULTIMOCONTROLLO to varchar
I assume since you called it DATAULTIMOCONTROLLO ("data ultimo controllo" ~ " last check date") you simply want to store the DATE (not a full datetime / not a timestamp)?

Try using the date type.

Also, before sending payload.topic2.DATAULTIMOCONTROLLO you could use a function or MOMENT or JSONata to convert the URC timestamp to a local YYYY/DD/MM string.

There are lots of threads on the forum that demonstrate converting a JS Date to a local / locale time.

And just as many that tell you not to store dates/times as local! Store as UTC if you want to avoid future DST/TZ issues.

1 Like

Do you mean here?

Solved by using MOMENT node

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