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 12:51] – 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** | + | < |
- | / | + | ::TEST_STRING |
- | /result_name=test_4 | + | </code> |
- | ! / | + | |
- | ! / | + | |
- | **;** | + | |
- | 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** | + | === Concatenation === |
- | /expression=(&:: | + | Literal string data must be explicitly concatenated with values from parameters. For example, there is a problem with the following Evaluate_Expression syntax: |
- | / | + | |
- | ! / | + | |
- | ! / | + | |
- | **;** | + | |
- | currently, the operators are only parsed as a single character, so the use of "/ | + | |
- | ==== modify ==== | + | < |
+ | Evaluate_Expression | ||
+ | /EXPRESSION=(:: | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
- | ==== parsing ==== | + | 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: |
- | 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. | + | < |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
- | there are 3 commands that extract a portion of a string. | + | === Negation === |
- | string_left(string, | + | Operators are only parsed as a single character, so the "/ |
- | string_right(string, | + | |
- | string_mid(string, | + | |
- | string_length(string) | + | |
- | string_find(string, | + | |
- | **note:** when referencing strings, the string should | + | |
- | \\ | + | In order to negate an expression you can use the syntax " |
+ | ==== Modify ==== | ||
- | === parsing string data (more...) | + | ==== Parsing ==== |
- | **set_pipeline_parameter_from_expression** | + | Given a pipeline parameter that is a string, there are four commands that extract a portion of a string: |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | the result | + | |
- | :: | + | STRING_LEFT(string, |
- | === string_left === | + | STRING_RIGHT(string, |
+ | STRING_MID(string, | ||
+ | STRING_FIND(string, | ||
- | **set_pipeline_parameter_from_expression** | + | and one command for measuring the string: |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | the result is | + | |
- | ::test_left = a12 | + | STRING_LENGTH(string) |
- | === string_right === | + | |
- | **set_pipeline_parameter_from_expression** | + | === String_Left === |
- | / | + | |
- | /expression=string_right("&:: | + | |
- | /as_integer=false | + | |
- | **;** | + | |
- | the result is | + | |
- | ::test_right = 789 | + | < |
- | === string_mid === | + | Set_Pipeline_Parameter_From_Expression |
+ | / | ||
+ | / | ||
+ | /AS_INTEGER=FALSE | ||
+ | ; | ||
+ | </ | ||
- | **set_pipeline_parameter_from_expression** | + | The result is: |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | the result is | + | |
- | ::test_mid | + | < |
- | //note: for string_mid the number values are zero based// | + | ::TEST_LEFT |
+ | </code> | ||
- | === string_length | + | === String_Right |
- | **set_pipeline_parameter_from_expression** | + | < |
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | / | + | The result is: |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | the result is | + | |
- | ::test_length | + | < |
- | **set_pipeline_parameter_from_expression** | + | ::TEST_RIGHT |
+ | </ | ||
- | / | + | === String_Mid === |
- | /expression=string_find("&:: | + | |
- | /as_integer=true | + | |
- | **;** | + | |
- | the result is | + | |
- | :: | + | Note that the two index parameters are zero-based for the STRING_MID function. |
- | \\ | + | |
+ | < | ||
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | === string_find === | + | The result is: |
- | **set_pipeline_parameter_from_expression** | + | < |
+ | ::TEST_MID = 345 | ||
+ | </ | ||
- | / | + | === String_Find === |
- | /expression=string_find("&:: | + | |
- | /as_integer=true | + | |
- | **;** | + | |
- | the result is | + | |
- | ::test_index = -1 | + | < |
- | === string_reverse_find === | + | Set_Pipeline_Parameter_From_Expression |
+ | / | ||
+ | / | ||
+ | /AS_INTEGER=TRUE | ||
+ | ; | ||
+ | </ | ||
- | === string_to_lower === | + | Because the string we are searching for " |
- | !converting to_upper and to_lower string data (more...) | + | < |
+ | :: | ||
+ | </ | ||
- | **set_pipeline_parameter_from_expression** | + | === String_Reverse_Find |
- | / | + | |
- | /expression=string_to_lower(" | + | |
- | /as_integer=false | + | |
- | **;** | + | |
- | **set_pipeline_parameter_from_expression** | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | **select_active_file** | + | |
- | / | + | |
- | ! /query= | + | |
- | **;** | + | |
- | **create_text_data** | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | ! / | + | |
- | ! / | + | |
- | **;** | + | |
- | **evaluate_expression** | + | |
- | / | + | |
- | ! / | + | |
- | ! / | + | |
- | ! / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | ! / | + | |
- | **;** | + | |
- | **evaluate_expression** | + | |
- | / | + | |
- | ! / | + | |
- | ! / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | ! / | + | |
- | **;** | + | |
- | === string_to_upper | + | |
- | === to_string === | + | To be completed... |
- | === example: extract text (more...) | + | === String_Length |
- | given the following text_data loaded from a file store in a signal text_data::scott:test | + | < |
- | random stuff < | + | Set_Pipeline_Parameter_From_Expression |
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </code> | ||
- | extract the name of the subject. | + | The result is: |
- | **set_pipeline_parameter_from_expression** | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | **set_pipeline_parameter_from_expression** | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | **set_pipeline_parameter_from_expression** | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | the resulting pipeline parameter contains " | + | |
+ | < | ||
+ | :: | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | The result is: | ||
+ | |||
+ | < | ||
+ | :: | ||
+ | </ | ||
+ | |||
+ | === String_To_Lower === | ||
+ | |||
+ | < | ||
+ | !Converting To_Upper and To_Lower String Data (more...) | ||
+ | |||
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | |||
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | |||
+ | Select_Active_File | ||
+ | / | ||
+ | ! /QUERY= | ||
+ | ; | ||
+ | |||
+ | Create_Text_Data | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | Evaluate_Expression | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | Evaluate_Expression | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | === String_To_Upper === | ||
+ | |||
+ | To be completed... | ||
+ | |||
+ | === To_String === | ||
+ | |||
+ | To be completed | ||
+ | |||
+ | ==== Example: Extracting text ==== | ||
+ | |||
+ | Given the following Text_Data loaded from a file, | ||
+ | |||
+ | < | ||
+ | Random Stuff < | ||
+ | </ | ||
+ | |||
+ | this example demonstrates how to store the desired string "< | ||
+ | |||
+ | < | ||
+ | !Extract the name of the subject. | ||
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | |||
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | |||
+ | Set_Pipeline_Parameter_From_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
visual3d/documentation/pipeline/general_information/string_data.1718801466.txt.gz · Last modified: 2024/06/19 12:51 by sgranger