Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ InTouch HMI

FileReadFields() function

  • Last UpdatedJul 22, 2024
  • 1 minute read

Reads the values contained in a csv file into a series of tagnames. You can use this function to load a set of tagname values.

Commas are the only supported delimiter.

This function can only be used for synchronous calls.

Syntax

[result = ] FileReadFields (filename, offset, starttag, numberoffields)

Parameters

filename

Name of the csv file to read the data from. A literal string value, a message tagname or a string expression.

offset

Location (in bytes) in the file to start reading. A literal integer value, integer tagname, or integer expression.

starttag

Name of the first tagname that receives the first read data item. The tagname must be enclosed with double quotes and end in a number, such as "MyTag1". A literal string value, message tagname (such as a message tagname containing the value "MyTag1"), or a string expression.

numberoffields

Number of data items to read from the csv file. A literal integer value, integer tagname, or integer expression. The first data item is read into the tagname defined in the starttag parameter, subsequent data items into tagnames with the incremented numeral suffix of the starttag parameter (MyTag1, MyTag2, MyTag3, ...).

Return value

Optional new file offset (in byte) after reading the data. This can be used to read the next set of data.

Example(s)

This script reads the values "Flour" to RecipeTag1, 27.23 to RecipeTag2, 14 to RecipeTag3, and 1 to RecipeTag4, and returns the new file offset—if the csv file c:\set.csv contains the following data: Flour, 27.23,14,1 and if the following tags are defined: RecipeTag1:message, RecipeTag2:real, Recipe3:integer, RecipeTag4:discrete.

FileReadFields("c:\set.csv",0,"RecipeTag1",4);

In This Topic
TitleResults for “How to create a CRG?”Also Available in