visual3d:documentation:pipeline:general_information:string_data
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
visual3d:documentation:pipeline:general_information:string_data [2024/06/19 14:01] – created sgranger | visual3d:documentation:pipeline:general_information:string_data [2024/10/04 15:36] (current) – Initial rework - the page is still missing string function descriptions. wikisysop | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Contents | + | ===== String Data ===== |
+ | String data is fundamentally different from time-varying signals and metrics so we have created a collection of string-specific functions within [[visual3d: | ||
+ | ==== Syntax ==== | ||
- | * [[#Syntax|1 Syntax]] | + | Within Evaluate_Expression, |
- | * [[#Modify|2 Modify]] | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
- | * [[# | + | |
+ | === Literal String Data === | ||
- | ==== Syntax ==== | + | Strings can be explicitly created within a pipeline script without having to be stored as a pipeline variable. To accomplish this, all that needs to be done is to use quotes. |
- | Quotes are to be used around string data in an expression to differentiate it from variable names. ie; subject_name="John Smith". Parameters in the pipeline that are strings, are not quoted (i.e.; EXPRESSION is a string, but you don't need quotes around it). Within EXPRESSION, our expression parser parses the variables, data and operators out of the expression. Data can be doubles or strings. If it is a string, Visual3D has no way to recognize the difference between a string and a variable name reference, except to quote the string data. | + | < |
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | /EXPRESSION="A123456789" | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | For example, there is a problem with the following evaluate_expression: | + | The result of this command |
- | **Evaluate_Expression** | + | < |
+ | :: | ||
+ | </ | ||
+ | |||
+ | === Concatenation === | ||
+ | Literal string data must be explicitly concatenated with values from parameters. For example, there is a problem with the following Evaluate_Expression syntax: | ||
+ | |||
+ | < | ||
+ | Evaluate_Expression | ||
/ | / | ||
/ | / | ||
! / | ! / | ||
! / | ! / | ||
- | **;** | + | ; |
+ | </ | ||
This uses a pipeline parameter in the middle of a string parameter (the EXPRESSION). Global parameters cannot be evaluated in the middle of a string, so to recognize that a pipeline parameter, you need to concatenate it into the expression as follows: | This uses a pipeline parameter in the middle of a string parameter (the EXPRESSION). Global parameters cannot be evaluated in the middle of a string, so to recognize that a pipeline parameter, you need to concatenate it into the expression as follows: | ||
- | **Evaluate_Expression** | + | < |
+ | Evaluate_Expression | ||
/ | / | ||
/ | / | ||
! / | ! / | ||
! / | ! / | ||
- | **;** | + | ; |
- | Currently, the operators | + | </ |
+ | |||
+ | === Negation === | ||
+ | |||
+ | Operators | ||
+ | |||
+ | In order to negate an expression you can use the syntax " | ||
==== Modify ==== | ==== Modify ==== | ||
Line 45: | Line 58: | ||
==== Parsing ==== | ==== Parsing ==== | ||
- | Given a pipeline parameter that is a string. For internal reasons, the string cannot be a number, or it will be interpreted as a number. | + | Given a pipeline parameter that is a string, |
- | + | ||
- | There are 3 commands that extract a portion of a string. | + | |
STRING_LEFT(string, | STRING_LEFT(string, | ||
STRING_RIGHT(string, | STRING_RIGHT(string, | ||
STRING_MID(string, | STRING_MID(string, | ||
- | STRING_LENGTH(string) | ||
STRING_FIND(string, | STRING_FIND(string, | ||
- | **NOTE:** When referencing strings, the string should be surrounded by quotes. This identifies to Visual3D that you are referencing a string, and not a file name etc. | ||
- | \\ | + | and one command for measuring the string: |
+ | STRING_LENGTH(string) | ||
- | === Parsing String Data (more...) === | ||
- | |||
- | **Set_Pipeline_Parameter_From_Expression** | ||
- | / | ||
- | / | ||
- | / | ||
- | **;** | ||
- | The result is | ||
- | |||
- | :: | ||
=== String_Left === | === String_Left === | ||
- | **Set_Pipeline_Parameter_From_Expression** | + | < |
+ | Set_Pipeline_Parameter_From_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | The result is | + | </ |
+ | The result is: | ||
+ | |||
+ | < | ||
::TEST_LEFT = A12 | ::TEST_LEFT = A12 | ||
+ | </ | ||
+ | |||
=== String_Right === | === String_Right === | ||
- | **Set_Pipeline_Parameter_From_Expression** | + | < |
+ | Set_Pipeline_Parameter_From_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | The result is | + | </ |
+ | The result is: | ||
+ | |||
+ | < | ||
:: | :: | ||
+ | </ | ||
+ | |||
=== String_Mid === | === String_Mid === | ||
- | **Set_Pipeline_Parameter_From_Expression** | + | Note that the two index parameters are zero-based for the STRING_MID function. |
+ | |||
+ | < | ||
+ | Set_Pipeline_Parameter_From_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | The result is | + | </ |
+ | The result is: | ||
+ | |||
+ | < | ||
::TEST_MID = 345 | ::TEST_MID = 345 | ||
- | //Note: For STRING_MID the number values are zero based// | + | </code> |
- | === String_Length | + | === String_Find |
- | **Set_Pipeline_Parameter_From_Expression** | + | < |
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | Because the string we are searching for " | ||
+ | |||
+ | < | ||
+ | :: | ||
+ | </ | ||
+ | |||
+ | === String_Reverse_Find === | ||
+ | |||
+ | To be completed... | ||
+ | |||
+ | === String_Length === | ||
+ | |||
+ | < | ||
+ | Set_Pipeline_Parameter_From_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | The result is | + | </ |
+ | |||
+ | The result is: | ||
+ | < | ||
:: | :: | ||
- | **Set_Pipeline_Parameter_From_Expression** | + | </ |
+ | < | ||
+ | Set_Pipeline_Parameter_From_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | The result is | + | </ |
+ | The result is: | ||
+ | |||
+ | < | ||
:: | :: | ||
- | \\ | + | </code> |
- | + | ||
- | + | ||
- | === String_Find === | + | |
- | + | ||
- | **Set_Pipeline_Parameter_From_Expression** | + | |
- | + | ||
- | /PARAMETER_NAME=TEST_INDEX | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | The result is | + | |
- | + | ||
- | :: | + | |
- | === String_Reverse_Find === | + | |
=== String_To_Lower === | === String_To_Lower === | ||
+ | < | ||
!Converting To_Upper and To_Lower String Data (more...) | !Converting To_Upper and To_Lower String Data (more...) | ||
- | **Set_Pipeline_Parameter_From_Expression** | + | Set_Pipeline_Parameter_From_Expression |
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | **Set_Pipeline_Parameter_From_Expression** | + | |
+ | Set_Pipeline_Parameter_From_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | **Select_Active_File** | + | |
+ | Select_Active_File | ||
/ | / | ||
! /QUERY= | ! /QUERY= | ||
- | **;** | + | ; |
- | **Create_Text_Data** | + | |
+ | Create_Text_Data | ||
/ | / | ||
/ | / | ||
Line 161: | Line 197: | ||
! / | ! / | ||
! / | ! / | ||
- | **;** | + | ; |
- | **Evaluate_Expression** | + | |
+ | Evaluate_Expression | ||
/ | / | ||
! / | ! / | ||
Line 171: | Line 208: | ||
/ | / | ||
! / | ! / | ||
- | **;** | + | ; |
- | **Evaluate_Expression** | + | |
+ | Evaluate_Expression | ||
/ | / | ||
! / | ! / | ||
Line 181: | Line 219: | ||
/ | / | ||
! / | ! / | ||
- | **;** | + | ; |
+ | </ | ||
=== String_To_Upper === | === String_To_Upper === | ||
+ | |||
+ | To be completed... | ||
=== To_String === | === To_String === | ||
- | === Example: Extract text (more...) === | + | To be completed |
- | Given the following Text_Data loaded from a file store in a signal TEXT_DATA:: | + | ==== Example: Extracting text ==== |
+ | |||
+ | Given the following Text_Data loaded from a file, | ||
+ | |||
+ | < | ||
Random Stuff < | Random Stuff < | ||
+ | </ | ||
- | Extract the name of the subject. | + | this example demonstrates how to store the desired string "< |
- | **Set_Pipeline_Parameter_From_Expression** | + | |
+ | < | ||
+ | !Extract the name of the subject. | ||
+ | Set_Pipeline_Parameter_From_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | **Set_Pipeline_Parameter_From_Expression** | + | |
+ | Set_Pipeline_Parameter_From_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | **Set_Pipeline_Parameter_From_Expression** | + | |
+ | Set_Pipeline_Parameter_From_Expression | ||
/ | / | ||
/ | / | ||
/ | / | ||
- | **;** | + | ; |
- | The resulting pipeline parameter contains " | + | </ |
visual3d/documentation/pipeline/general_information/string_data.1718805661.txt.gz · Last modified: 2024/06/19 14:01 by sgranger