Forum Home › Forums › Understanding the Software › Storing the result of a formula with Database Import Driver
- This topic has 6 replies, 2 voices, and was last updated 4 years, 11 months ago by
David01.
-
AuthorPosts
-
December 2, 2020 at 10:51 am #7630
David01
ParticipantHello,
I am using a database to store data from Rapid Scada. I want to save the value of an input into a table.
In order to do this, I have created an output with a formula that references the value I want to save. It has the same command number as that the one I defined in the driver. The problem is that, when I send a command, the value saved is whatever value is written in the command, instead of the result of the formula.
The SQL code I am using for the command is:
INSERT INTO data (Counter1) VALUES (@cmdVal);
So, my question is: How can I write the result of a formula in a MySQL database?
-
This topic was modified 4 years, 12 months ago by
Mikhail.
December 2, 2020 at 2:09 pm #7634
MikhailModeratorHello,
Do you use Database Import Driver?
December 2, 2020 at 2:10 pm #7635
MikhailModeratorPlease provide screenshots that illustrate your settings and system behavior.
December 3, 2020 at 1:53 pm #7642David01
ParticipantYes. I am using Database Import Driver.
I managed to make it work on my own. I think I had done something wrong with the configuration. I am sorry for the trouble.
Now I have another question: Is there a way to store data in a database automatically over time , without a prompt?
If I understood this correctly, the only way to save data is by sending a command, isn’t it?
December 4, 2020 at 9:53 am #7652David01
ParticipantAlso, is there a way to store multiple data in a single sql table with a single command?
The documentation references the cmdVal variable, but that only sends the value of the current command. So, what if I need to store several variables?
For example, table1 has two columns: variable1 and variable2. I can use an SQL query like this:
INSERT INTO table1(variable1, variable2) VALUES (@cmdVal, null)
I can only pass the data for variable1, that’s why I am forced to pass a null value to variable2. Do I need to create an aditional command to write variable2 on the table?
December 4, 2020 at 1:49 pm #7660
MikhailModeratorIs there a way to store data in a database automatically over time , without a prompt?
You should use DB Export Module of SCADA-Server instead of DB Import driver.
If I understood this correctly, the only way to save data is by sending a command, isn’t it?
It’s true for DB Import Driver.
-
This reply was modified 4 years, 11 months ago by
Mikhail.
December 4, 2020 at 1:52 pm #7662David01
ParticipantThank you. I will look into it.
-
This topic was modified 4 years, 12 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.