This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
ST Get plain text
|
ST Get plain text ( {* ;} object {; refMode} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
* | Operator |
![]() |
If specified, object is an object name (string) If omitted, object is a variable or a field | |||||
object | Form object |
![]() |
Object name (if * is specified) or Variable or field (if * is omitted) | |||||
refMode | Longint |
![]() |
Mode for handling references found in the text | |||||
Function result | Text |
![]() |
Text without tags | |||||
The ST Get plain text command removes any style tags from the text variable or field designated by the * and object parameters and returns the plain text.
If you pass the optional * parameter, this indicates that the object parameter is an object name (string). During execution, if the object has the focus, the command returns information about the object being edited; however, when the object does not have the focus, the command returns information about the data source (field or variable) of the object.
If you omit the * parameter, this indicates that the object parameter is a field or a variable. In this case, you pass a field or variable reference instead of a string and during execution, the command returns information about this field or variable.
The optional refMode parameter indicates the way that references found in object must be returned. In refMode, pass one of the following constants, found in the "Multistyle Text" theme (you can pass a single constant or a combination):
Constant | Type | Value | Comment |
ST 4D Expressions as sources | Longint | 2 | The original string of 4D expression references is returned |
ST 4D Expressions as values | Longint | 1 | 4D expression references are returned in their evaluated form (default functioning in forms) |
ST References as spaces | Longint | 0 | Each reference is returned as a non-breaking space character (default operation, used by other commands) |
ST Tags as plain text | Longint | 64 | The label of the tag is returned in plain text. For example for the tag '<img src="test.jpg" alt="picture">my picture</img>', the plain text is "my picture" (default functioning in forms) |
ST Tags as XML code | Longint | 128 | The XML code of the tag is returned in plain text. For example for the tag '<img src="test.jpg" alt="picture">my picture</img>', the plain text is '<img src="test.jpg" alt="picture">my picture</img>' |
ST Text displayed with 4D Expression sources | Longint | 86 | Returns the text as it is shown in the forms with the original string of the 4D expressions. Corresponds a predefined combination of constants 2+4+16+64. |
ST Text displayed with 4D Expression values | Longint | 85 | Returns the text as it is shown in the forms with the 4D expressions in their evaluated form. Corresponds to a predefined combination of constants 1+4+16+64. |
ST URL as labels | Longint | 4 | The visible label of URLs is returned, for example "Visit our Web site" (default functioning in forms) |
ST URL as links | Longint | 8 | The link is returned, for example "http://www.4d.com" |
ST User links as labels | Longint | 16 | The visible label of the user link is returned (default functioning in forms) |
ST User links as links | Longint | 32 | The contents of the user link is returned |
Note:
You are looking for the text "very nice" among the values of a multistyle text field. The value was stored in the following form: "The weather is very nice today".
QUERY BY FORMULA([Comments];ST Get plain text([Comments]Weather)="@very nice@")
Note: In this context, the following statement will not give the desired result because the text is saved with style tags:
QUERY([Comments];[Comments]Weather="@very nice@")
Given the following text placed in the multi-style area entitled "MyArea":
<span>It is now <span style="-d4-ref:'Current time:C178'"> </span> <a href="http://www.4d.com">Go to the 4D site</a> or <span style="-d4-ref-user:'openW'">Open a window</span></span>
This text is displayed:
If you execute the following code:
$txt :=ST Get plain text(*;"myArea";ST References as spaces)
// $txt = "It is now or " (spaces)
$txt :=ST Get plain text(*;"myArea";ST 4D Expressions as values)
// $txt = "It is now 15:48:19 or "
$txt :=ST Get plain text(*;"myArea";ST 4D Expressions as sources)
// $txt = "It is now Current time or "
$txt :=ST Get plain text(*;"myArea";ST URL as links)
//$txt = "It is now http://www.4d.com or "
$txt :=ST Get plain text(*;"myArea";ST Text displayed with 4D Expression values)
//$txt = "It is now 15:48:19 Go to the 4D site or Open a window"
$txt :=ST Get plain text(*;"myArea";ST Text displayed with 4D Expression sources)
//$txt = "It is now Current time Go to 4D site or Open a window"
$txt :=ST Get plain text(*;"myArea";ST User links as labels)
//$txt = "It is now or Open a window"
$txt :=ST Get plain text(*;"myArea";ST User links as links)
//$txt = "It is now or openW"
After this command is executed, the OK variable is set to 1 if no error occurred; otherwise, it is set to 0. This is the case more particularly when style tags are not evaluated properly (incorrect or missing tags).
In the case of an error, the variable is not changed. When an error occurs on a variable when text is being evaluated, 4D transforms the text into plain text; as a result, the <, > and & characters are converted into HTML entities.
Product: 4D
Theme: Styled Text
Number:
1092
Created: 4D v12
Modified: 4D v12.1
Modified: 4D v14
Renamed: 4D v14 (OBJECT Get plain text)
multistyle, multi style, multi-style
4D Language Reference ( 4D v20 R7)