Using Cut, Copy and Paste of Variables with Behaviors
When you copy and paste a variable with one or more behaviors, the behaviors are included in the paste and a duplicate behavior is created for the duplicate variable.
Should the behavior be one that includes one or more variables in its configuration (threshold, chronometer, etc.) then those variables will also be duplicated as long as they are only used in a behavior of one variable.
If several behaviors use the same variables in their configuration (for example a common reset variable for several chronometers), then those variables common to the behaviors will not be duplicated.
The Application Explorer will determine the strategy to apply for a copy paste by analyzing both the name of the variable and the names of the variables involved in the behavior. It will duplicate the behavior variables as long as their names conform to the following rule.
- The full name (that is branch and leaf) of any variable included in a behavior that is to be copied and pasted should contain the name of the leaf of the variable to which the behavior is attached.
This example of a register with chronometer behavior, that follows this rule, illustrates this.
| Original variables | Copy to new variable name under the same branch |
Copy same variable name to new branch Branch02 | |
| Register | Branch01.Register01 | Branch01.Register02 | Branch02.Register01 |
| Trigger bit | Branch01.Register01.Trigger | Branch01.Register02.Trigger | Branch02.Register01.Trigger |
| Init bit | Branch01.Register01.Reset | Branch01.Register02.Reset | Branch02.Register01.Reset |
| Register | Branch01.Register01 | Branch01.Register02 | Branch02.Register01 |
| Trigger bit | Branch01.Register01_Trigger | Branch01.Register02_Trigger | Branch02.Register01_Trigger |
| Init bit | Branch01.Register01_Reset | Branch01.Register02_Reset | Branch02.Register01_Reset |
If the names used for the included variables do not follow this rule, the variables included in the behavior of the newly pasted variable will keep the original names.
| Original variables | Copy to new variable name under the same branch |
Copy same variable name to new branch Branch02 | |
| Register | Branch01.Register01 | Branch01.Register02 | Branch02.Register01 |
| Trigger bit | Branch01.Trigger | Branch01.Trigger | Branch01.Trigger |
| Init bit | Branch01.Reset | Branch01.Reset | Branch01.Reset |
Copy and paste of a register with threshold behavior
If you add a threshold behavior to a register, the names of the threshold variables that it automatically generates do not follow the above rule. The threshold variable name contains a modified copy of the register name including the threshold type. The copy paste behavior is modified to accommodate this. The following table illustrates this.
| Copied variable name | Pasted variable name | |
| Register | Branch01.Register01 | Branch01.Register02 |
| Hi hi threshold | Branch01.Register01_HiHi | Branch01.Register02_HiHi |
| High threshold | Branch01.Register01_High | Branch01.Register02_High |
| Low threshold | Branch01.Register01_Low | Branch01.Register02_Low |
| Lo lo threshold | Branch01.Register01_LoLo | Branch01.Register02_LoLo |
If the Variables Tree contains threshold behavior using a non-standard naming scheme you should avoid copy and paste of those particular variables as the paste will not work and may destroy the link between the original variable and its thresholds.