Read from text file

how to read values from text file and write to tags only once when values are changed?
can any one give solution for this

You can do this in scripting either automatically every x amont of time or manually when someone presses a button. The script will be something like this:fileStr = system.file.readFileAsString("C:\\Path\\To\\File.txt") system.tag.writeToTag("Path/To/Tag", fileStr)Of course that script is really simple, so in order to give you a better script what does your file look like? Is it a CSV? There are several ways to read in values and write them to tags.

I just noticed that you posted this question twice: one here and one the Ignition section. Please don’t post this question to two different forums. In the future you only need to post the question once and we will answer it.

this is not a csv file,it is a text file with comma delimited.
atleast give me the reply for how to find out “a text file is changed or not”?
what are the steps to find the text file is changed or not in ignition?
please mention the steps.

You could try this as well. The posted version is for 7.3, bit I’ll post the 7.4 and 7.5 versions really next week
viewtopic.php?f=88&t=7885

I’ll requote myself from the duplicate post…

[quote=“JordanCClark”]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.
[/quote]

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