Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello ,
I am able to upload a CSV file into the platform and able to make those values in CSV file to store in a infotable in thingworx platform.
But from there I should insert the values into a table that exists in the external database like postgres .
I had gone through the community but I did'nt find any solution.
Can someone please help me out .
Regards,
Bhargav.
I just wanted to follow up to see if previous response was helpful for your question?
If so, please indicate the appropriate response as the Accepted Solution for the benefit of other Community members who have the same question. If you are still experiencing issues, please do let us know your questions or concerns.
Thanks,
Vibhuti
var tableLength = infotables.rows.length;
for (var x=0; x < tableLength; x++) {
var row = infotables.rows[x];
//var result = row.id;
try {
var command = "INSERT INTO containerproduct (containerid,productname ) VALUES ('" +
row.id + "', '" + row.productname + "')";
logger.debug("Database_test.Insert_data_to_database(): Query - " + command);
var result = me.run_command({command: command});
} catch(error) {
logger.error("Database_test.Insert_data_to_database(): Error - " + error.message);
}
}
This the code I am using to insert the data in infotable to external database by local(javascript) service but I am unsuccessful in inserting.
I have written one more service with sql command and that service has an input as command with base type as String and code section is filled with <<command>>
Where the command in the above code gives input to the sql command service.
Regards,
Bhargav Sai Ch
What errors you are seeing?
Have you had the opportunity to review these community posts?