TextDocument Data Object

Help Contents

Introduction

A TextDocument Data Object represents the contents of a text document.

The text in the document can be queried using a Text Selector.

These document formats are supported:

Creating a TextDocument Data Object

How you create a TextDocument Data Object depends on where the IEC 61131-3 code is running:

TextDocument Functions

These TextDocument Data Object functions are supported:

FunctionDescription
TextDocFromString Creates a TextDocument Data Object from a string value.
TextDocGetValue Returns a value from a TextDocument Data Object using a Text Selector.

Examples

  1. Code for an Operator Action displaying the first three lines of a text document in a Message Dialog:
    VAR
        TextDocId, Index : DINT;
        Selector, Line : STRING;
        Message: STRING[1024];
    END_VAR
    
    (* Create the TextDocument Data Object *)
    TextDocId := TextDocFromTagFile('Name Of Text Page Tag', 'Text');
    
    Message := '';
    FOR Index:=1 TO 3 DO
        Selector := CONCAT( 'Line(', TO_STRING(Index), ')');
        Line := TO_STRING( TextDocGetValue( TextDocId, Selector ) );
        Message := CONCAT( Message, Line, '$n' );
    END_FOR
    
    (* Display the content *)
    MessageDialog( 'Information', Message );
    

Further Information

Data Objects

To learn how to use data objects in IEC 61131-3 code.

IEC 61131-3

To learn how IEC 61131-3 is used in Fernhill SCADA.

Glossary

For the meaning of terms used in Fernhill SCADA.