Returns the n-th line of the text. The end of a line is determined by the return character ¶. This function returns all characters including the return character.
TrText_GetLine ( switches ; lineNumber ; theText )
|switches||(optional) determine the way the result is returned|
|lineNumber||the number of the line you want|
|theText||the text which you want to get a line from|
Switches can be empty or:
|-ReturnAtEnd||add a return character at the end|
|-Unused||use this to make clear switches are not used, you can also use ""|
Data type returned
The n-th line of text: all characters including the return character.
An empty line will result in a single return character.
If you request a line that is not in the text an empty text is returned. This makes it easy to use this function in a loop: start with line number 1 and increase until the result is empty.
Troi Text Plug-in 1.2
FileMaker Pro 16 to 19
The formatting in a layout does not alter the text field’s contents. So if a field is formatted small, the lines of that layout may be wrapped but this does not enter extra returns into the text field.
The calculation in which this function is used can be both stored and unstored. You can use this function in function definitions or in a Set Field or Set Variable script step.
result = TrText_GetLine ( "-ReturnAtEnd" ; 2 ; "abc¶def¶ghi" )
this will return as result the second line: “def¶”
We assume that in your FileMaker file the following fields are defined:
TheText Text gRequestedLineNo Global, number gLine Global, text
TrText-GetLine ( gRequestedLineNo ; TheText )
will return the line indicated by gRequestedLineNo. This can be used in a script to extract single lines:
Set Field [ gRequestedLineNo ; 1 ] Loop Set Field [ gLine ; TrText_GetLine ( "-Unused" ; gRequestedLineNo ; TheText ) ] Exit Loop If [ gLine = "" ] Comment [ Do your stuff here... ] Set Field [ gRequestedLineNo ; gRequestedLineNo + 1 ] End Loop
Text field “Text1” consists of the following lines:
this is line 2.
line 3 is line 3!
line5 (line 4 is empty).
The result of
TrText_GetLine ( gRequestedLineNo ; Text1 )
depends on the value of gRequestedLineNo:
gRequestedLineNo: Returned result: Remarks: 1 line 1¶ 2 this is line 2.¶ 3 line 3 is line 3!¶ 4 ¶ only a return character is returned 5 line5 (line 4 is empty).¶ 6 no more lines: result is empty 0 invalid number: result is empty