Monitoring Database state in Factory studio

Dear Expert
In my Project, I used SQL Server to store data from Factory studio. The machine installed Factory studio and machine installed SQL Server is different. The dataset in Factory studio " TagHistorian


I could connect Factory to SQL Server and store data well.

  1. How can I monitoring the connection status between Factory studio and SQL server in order to show this status on HMI application ?.
  2. How can I get the remain capacity of SQL server into Factory studio. because when SQL server is full nearly, I need Factory studio alarm to operator about this case.
    Best.

Hi Manh,

We received your question and we are working on it.

Bests,
Tatsoft Team.

Hi Manh,

  1. You can use the following code to see tha last statusMessage your DB returned, if it is working fine it will show “OK”:
    @Tag.text = @Dataset.DB.Provider1.OpenStatusMessage;

It will be the same message which appears in Module Information:

  1. We are still checking and we will let you know soon.

Bests,
Tatsoft Team.

Hi Manh,

You can get the remaining capacity of the SQL server into Factory studio by running a Query.

  1. Create a tag in Edit > Tags > Objects, like the image below:
    tag

  2. Create a Query in Edit > Datasets > Queries, like the image below:

  3. Insert the following code in the Script to execute the query:
    image
    image

After that, you will be able to manipulate the Tag created in the first step, which contains a text with the value of remaining capacity in the SQL server.

Note: The line command from number 3 should not be called in CodeBehind, the reason for that is, if the Query fails in CodeBehind it can cause performance issues because CodeBehind is just one thread, so you should call a Task doing a trigger in CodeBehind and this Task execute the Query… The task is another thread.

Bests,
Tatsoft Team.