Read values from text file

how to read values from text file and write to tags only when particular value is changed?
can any one give the solution to this problem

:laughing: mubin :laughing:

Hi! Welcome to the forums!

I’m going to proceed under the assumption that the text file is the only thing driving the tag values.

In this instance I’d recommend creating an externally driven SQLTag Provider. This whitepaper gives details on whats involved on rolling your own custom provider.

This topic covers a project where I parse text from an xml file to create and populate tags in-- you guessed it-- a custom SQLTag provider. It should be customizable to handle whatever text format you have going on.

Let me know if I’m thinking in the right direction, or if there is some other thing being overlooked in the application.

[quote=“mubin”]how to read values from text file and write to tags?
we have one procedure to write to tags i.e.
read file path as
file=“path name/textfile.txt”
tags path=(“tag1”,“tag2”,…)
new values=(X[0],X[1],…)
system.tag.writeToTags(tags path,new values)

      but with this script it is writing continuously to tags. we want to write to tags only one time.
      so what is the solution for that?
      please any one give me the reply.

:laughing: mubin :laughing:[/quote]

Please refer to this post here:


Since you’re looking for only changed values, you would need to grab the previous values. You can do this by either:

1: reading all your tags and comparing the values.
2: renaming the file with the current values to hold the previous values. Then read two files (one with the current values and the one you renamed) and compare.

How many tags are you processing? Depending on the number, there may not be a whole lot of overhead to worry about anyway.