Conditional Statement: Difference between revisions

From Software Product Documentation
Jump to navigation Jump to search
No edit summary
 
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:




This command was fully released in Visual3Dv6. The command is usable but hidden in most versions of Visual3Dv5.
This command was modelled after the [[For_Each]] command in the sense that there is a start (Conditional_Statement) and an ending event (Conditional_Statement_End).


<b>NOTE:</b> This command was previously called the Expression_Loop. Scripts referring to this old command name will still work.
When the pipeline comes to an Conditional_Statement command, it will evaluate the expression using the same syntax as the [[Expressions|Evaluate_Expression]] command. If the expression is TRUE (returns any value other than zero), all of the commands between the Conditional_Statement and Conditional_Statement_End commands will be executed. If the expression is FALSE (returns a zero), all the commands that are between the Conditional_Statement and Conditional_Statement_End commands will be skipped.


==Pipeline Syntax==
The ITERATION_PARAMETER_NAME is used to distinguish between different Conditional_Statement commands so that Conditional_Statement and Conditional_Statement_End commands can be unambiguously associated with each other.


'''Conditional_Statement'''
<b>NOTE:</b> If there is more than one active file then the Conditional_Statement command will be skipped. This is because the expression might be TRUE for some files and FALSE for others, leaving Visual3D in an ambiguous place.
<b>/ITERATION_PARAMETER_NAME=</b>
<b>/[[Expressions|EXPRESSION]]=</b>
''';'''
'''Conditional_Statement_End'''
<b>/ITERATION_PARAMETER_NAME=</b>
''';'''


==Pipeline Explanation==
<b>NOTE:</b> This command was previously called the Expression_Loop. Scripts referring to this old command name will still work.
 
This command was modeled after the [[For_Each]] command in the sense that there is a start (Conditional_Statement) and an ending event (Conditional_Statement_End).


When the pipeline comes to an Conditional_Statement command, it will evaluate the expression. The expression uses the same syntax as the [[Expressions|Evaluate_Expression]] command. If the expression is TRUE (returns any value other than zero), all of the subsequent commands will be executed. If the expression is FALSE (returns a zero), all the commands that are between the Conditional_Statement and Conditional_Statement_End commands will be skipped.
==Syntax==


The ITERATION_PARAMETER_NAME is just used to identify which Conditional_Statement and Conditional_Statement_End commands are associated with each other.
===Conditional_Statement===
:/ITERATION_PARAMETER_NAME=
:/[[Expressions|EXPRESSION]]=
:''';'''


The loop is essentially meant to act as an if statement - if the expression is true, the loop will be entered. The Conditional_Statement_End command acts as the closing bracket for the statement.
===Conditional_Statement_End===
:/ITERATION_PARAMETER_NAME=
:''';'''


==Pipeline Example==
==Pipeline Example==

Latest revision as of 22:03, 4 January 2024


This command was modelled after the For_Each command in the sense that there is a start (Conditional_Statement) and an ending event (Conditional_Statement_End).

When the pipeline comes to an Conditional_Statement command, it will evaluate the expression using the same syntax as the Evaluate_Expression command. If the expression is TRUE (returns any value other than zero), all of the commands between the Conditional_Statement and Conditional_Statement_End commands will be executed. If the expression is FALSE (returns a zero), all the commands that are between the Conditional_Statement and Conditional_Statement_End commands will be skipped.

The ITERATION_PARAMETER_NAME is used to distinguish between different Conditional_Statement commands so that Conditional_Statement and Conditional_Statement_End commands can be unambiguously associated with each other.

NOTE: If there is more than one active file then the Conditional_Statement command will be skipped. This is because the expression might be TRUE for some files and FALSE for others, leaving Visual3D in an ambiguous place.

NOTE: This command was previously called the Expression_Loop. Scripts referring to this old command name will still work.

Syntax

Conditional_Statement

/ITERATION_PARAMETER_NAME=
/EXPRESSION=
;

Conditional_Statement_End

/ITERATION_PARAMETER_NAME=
;

Pipeline Example

This script will prompt the user to specify if walking or running trials are being processed. Based on the user's selection, different processing will be completed. In this example, the pipeline parameter TEST will be set to 1 if the condition is Walk, and set to 2 if the condition is Run.

Prompt_For_Pipeline_Parameter_Value
/PIPELINE_PARAMETER_NAME=CONDITION
/PROMPT=Select Condition:
/DATA_TYPE=STRING
/DEFAULT_VALUE=Walk
/USE_POSSIBLE_VALUES=TRUE
/POSSIBLE_VALUES=Walk+Run
! /USE_UNITS=FALSE
! /DEFAULT_UNITS=
! /USE_POSSIBLE_UNITS=FALSE
! /POSSIBLE_UNITS=
! /CONVERSIONS=
;

Conditional_Statement
/ITERATION_PARAMETER_NAME=STATEMENT_1
/EXPRESSION= "&::CONDITION&" == "WALK"
;

Set_Pipeline_Parameter
/PARAMETER_NAME=TEST
/PARAMETER_VALUE=1
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
! /MULTI_PASS=FALSE
;

Conditional_Statement_End
/ITERATION_PARAMETER_NAME=STATEMENT_1
;

Conditional_Statement
/ITERATION_PARAMETER_NAME=STATEMENT_2
/EXPRESSION= "&::CONDITION&" == "RUN"
;

Set_Pipeline_Parameter
/PARAMETER_NAME=TEST
/PARAMETER_VALUE=2
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
! /MULTI_PASS=FALSE
;

Conditional_Statement_End
/ITERATION_PARAMETER_NAME=STATEMENT_2
;
Retrieved from ""