<< Click to Display Table of Contents >> Script Ver1 (SC1 syntax) |
What is SC1 syntax?
This chapter explains the syntax of Script Ver1 (hereafter referred to as SC1).
The SC1 syntax is intended to allow easy use of simple calculations, and is a simple script for performing calculations between tags using Visual Basic compatible operators such as + - * / < >.
Since processing is executed one line at a time, you cannot use if statements (conditional branching) or for statements (repeated processing). If you want to perform more advanced processing, please use Script Ver2 (SC2 syntax).
SC1 can be used from the following:
•FA-Server "Script Ver1 Action"
•FA-Server Script execution on the detailed settings tab of each action
In version 4 of this package, it was called tag script, but in Ver5 and later, the name was changed to Script Ver1 (abbreviated as SC1 syntax) in order to streamline the script syntax system. |
Basic Syntax
The SC1 syntax is written as follows:
Tag path 1 = Calculation expression 1 Tag path 2 = Expression 2 Tag path 3 = Expression 3 |
When the script is executed, the result of the formula is written to the tag. The formula can contain a tag path. If you want to write multiple formulas, write them on separate lines. All calculations are done numerically, with "TRUE" being treated as 1 and "FALSE" being treated as 0, and characters being converted to numbers.
example)
U01.F01.T01 = 1 U01.F01.T01 = U01.F01.T02 * (U01.F01.T03 + 1) U01.F01.T01 = (U01.F01.T02 And U01.F01.T03) Or (U01.F01.T04 And U01.F01.T05)
SC1 syntax cannot handle characters. For character type tags, characters are converted to numbers and processed. If you want to handle values as characters, for example to combine strings, please use Script Ver2 (SC2 syntax). |
Operators
The available operators are summarized below.
Operator |
|||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Arithmetic Operators |
|
||||||||||||||||||||||||
Comparison Operators |
|
||||||||||||||||||||||||
Logical Operators |
|
Calculation example |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Arithmetic Operators |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comparison Operators |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Logical Operators |
|
When multiple operators are used in an expression, they are evaluated in a certain order. Arithmetic operators are evaluated first, followed by comparison operators, and then logical operators. Arithmetic and logical operators are evaluated in the order shown in the table above. All comparison operators have the same precedence. You can force a different precedence order by using parentheses "()". Operations inside parentheses always take precedence over operations outside parentheses. |
When using Network tag in a script, add "//Network/" Please add.
example) //Network/N01/T01 |