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

Edge HMI

GetLine

  • Last UpdatedOct 29, 2026
  • 4 minute read

GetLine gets a line of text from an external file and then stores that line in a project tag.

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

GetLine

File

Synchronous

Yes

Supported

Supported

Supported

Supported

Supported

Syntax

GetLine(strFileName,Search,"strTagStore",optNumCase,"optNumTagOveflow",optNumRunFromServer)

strFileName

The name of the external file. It can be either a simple file name (for example, file.txt) or a fully qualified path name (for example, C:\path\to\file.txt). We recommend that you do not specify a "relative" file path (for example, ..\file.txt), because this function may look for the file in different locations depending on where and how it is executed. For more information, see Notes below.

Note: Follow the conventions of the target platform for the file path and name, and separators. For example, a file path in Windows starts with a drive letter and uses backward slashes as separators (C:\path\to\file), while a file path in Linux starts at the root directory and uses forward slashes as separators (/path/to/file).

Search

There are two options for this parameter, depending on the data type of the value or tag that you specify:

  • If it is a string value or tag, this function will search the external file for the first occurrence of the string and then copy the entire line that contains the occurrence to the tag specified for tagStore. Additional occurrences will be counted (see "Returned value" below) but not copied.

  • If it is a numeric value or tag, this function will go to that line number in the external file and then copy the entire line to the tag specified for tagStore. The first line of the external file is line 0.

    tagStore

    The name of the String tag to which the line will be copied.

    Note: If this parameter is enclosed in quotes, the string literal will be used. Otherwise, the value of the tag/expression will be used.

    optNumCase

    A numeric flag that specifies whether the search is case-sensitive:

    Value

    Description

    0

    Not case-sensitive

    1

    Case-sensitive

    This parameter is optional; if no value is specified, the default value is 0.

    optNumTagOverflow

    The name of an Integer tag that will receive a code that indicates whether the line overflows the String tag specified for tagStore.

    This parameter is optional; if no value is specified, the overflow code will not be received.

    Note: If this parameter is enclosed in quotes, the string literal will be used. Otherwise, the value of the tag/expression will be used.

    The overflow code is separate from the value returned by the function itself (see "Returned value" below). The possible values of the overflow code are:

    Value

    Description

    0

    OK

    1

    Overflow

    The size limit for String tags in projects running on Windows or Windows Embedded is 1024 characters, which means that if the tag specified for optNumTagOverflow receives an overflow code of 1, the line is more than 1024 characters long and it overflowed the tag specified for tagStore.

    This parameter is not supported in projects running on IoT View; the tag specified for optNumTagOverflow will always receive an overflow code of 0, regardless of the actual length of the line.

    optNumRunFromServer

    A numeric flag that specifies whether this function should be run from the project thin client or the project runtime server:

    Value

    Description

    0

    Run from the project thin client

    1

    Run from the project runtime server

    This parameter is optional; if no value is specified, the default value is 0.

    For more information about how this parameter affects the execution of this function, see Notes below.

Returned value

If this function is executed successfully, it returns the total number of lines in which the search string was found. Otherwise, it returns one of the following possible values:

Value

Description

0

String was not found in the target file

-1

File not found

-2

Invalid strFileName parameter

-3

Invalid strSeqChar parameter (obsolete)

-4

Invalid tagStore parameter

-5

Invalid optNumCase parameter

-6

Invalid optNumTagOverflow parameter

-7

Invalid number of parameters

-8

Invalid line number

Notes

This function supports only ASCII and UTF-16LE text encoding on all versions of Windows. (UTF-16LE is the Unicode implementation that is natively supported by Windows.) Therefore, if you use this function to get text from a UTF-8 or UTF-16BE encoded file, the function should be executed successfully but you might see some unknown or invalid characters.

Where this function will look for the file depends on where the function was called and on the values specified for strFileName and optNumRunFromServer:

If function is called on…

…and strFileName is…

…and optNumRunFromServer is…

…it looks for the file…

Project runtime server, in a background task

File name only

0

On the server, in the project folder and its Web sub-folder. (optNumRunFromServer is ignored.)

1

File path and name

0

On the server, in the specified file path. (optNumRunFromServer is ignored.)

1

Secure Viewer (incl. local Viewer)

File name only

0

Not valid; file cannot be found.

1

On the server, in the project folder and its \Web sub-folder.

File path and name

0

On the client, in the specified file path.

1

On the server, in the specified file path.

Web Thin Client or Mobile Access

File name only

0

On the server, in the location specified in the browser's address bar. Typically, that is the project's \Web sub-folder, which contains the project screens published as web pages, but it might be another location if the web pages were copied or moved after they were published. The latter is often true for Mobile Access and always true for IoT View. Check the web server to see what folder(s) it is configured to serve.

1

On the server, in the project folder and its \Web sub-folder.

File path and name

0

On the client, in the specified file path.

1

On the server, in the specified file path.

Examples

Find the first occurrence of Edge HMI in a file located on the client, and then store the line that contains the occurrence in the tag ReturnedLine:

GetLine("C:\Readme.txt","AVEVA Edge","ReturnedLine")

Find the third line of a file located on the server, and then store that line in the tag ReturnedLine:

GetLine("C:\Readme.txt",2,"ReturnedLine",0,"Overflow",1)

In This Topic
Related Links