Difference between revisions of "Formula Specification in Templates"

From wiki.fine.cz
Jump to navigation Jump to search
Line 36: Line 36:


- result can be number, text, logical value
- result can be number, text, logical value
|Result is number (bold inputs linked to data '''X[0;1;2;3;4;5;6]'''):
|Result is number (bold inputs linked to data '''''X[0;1;2;3;4;5;6]'''''):
''IF(220>200;220-200;200-220) ⇒ 20''
''IF(220>200;220-200;200-220) ⇒ 20''


Line 42: Line 42:


''IF(MAX('''[X⇓2:⇓3]''')>'''[X⇓7]''';MAX('''[X⇓2:⇓3]''');'''[X⇓7]''')) ⇒ 6''
''IF(MAX('''[X⇓2:⇓3]''')>'''[X⇓7]''';MAX('''[X⇓2:⇓3]''');'''[X⇓7]''')) ⇒ 6''
''IF(MAX('''⟨1;2⟩''')>'''6''';MAX('''⟨1;2⟩''');'''6''') ⇒ 6''


Result is text:
Result is text:


''IF('''[Coordinate Z]'''>0;"Top above terrain";"Top under terrain")''
''Input'' '''''[Coordinate Z]''''' ''= 210''';[GWT]''' = 180''


''IF('''[GWT]'''<'''[Coordinate Z]''';"GWT under top of the test.";"Measure error.")''
''IF('''[Coordinate Z]'''>0;"Above terrain";"Under terrain") ⇒ "Top above terrain"''
 
''IF('''[GWT]'''<'''[Coordinate Z]''';"GWT under top of the test.";"Measure error.") ⇒ "GWT under top of the test."''
|-
|-
|IFS
|IFS
Line 58: Line 62:
|''NOT(Boolean)''
|''NOT(Boolean)''
|Reverses the logic of its argument
|Reverses the logic of its argument
|
|''IF(NOT(5>6);175;155) ⇒ 175''
''IF(NOT(5>4);175;155) ⇒ 155''
 
''IF(NOT("A"="B");175;155)⇒ 175''
|-
|-
|SWITCH
|SWITCH
|''SWITCH(Switch;Case1;Result1;Case2;Result2; ... ;[ Else ])''
|''SWITCH(Switch;Case1;Result1;Case2;Result2; ... ;[ Else ])''
|Evaluates an expression against a list of values and returns the result corresponding to the first matching value. If there is no match, an optional default value may be returned
|Evaluates an expression against a list of values and returns the result corresponding to the first matching value. If there is no match, an optional default value may be returned
|''SWITCH(50>6;TRUE();44;FALSE();56;-111) ⇒ 44''
|''SWITCH(<u>50>6</u>;<u>TRUE()</u>;44;FALSE();56;-111) ⇒ 44''
''SWITCH(<u>30/6</u>;3;120;4;220;<u>5</u>;320;420) ⇒ 320''
|}
|}



Revision as of 15:17, 22 May 2023

List of formula specification using in Templates.

Categories of functions:

Logical

Name Syntax, parameters Description Example
AND AND(Boolean1;Boolean2; ... ) Returns TRUE if all of its arguments are TRUE AND(3=3;2=2) ⇒ TRUE
OR OR(Boolean1;Boolean2; ... ) Returns TRUE if any of its arguments are TRUE OR(3=4;2=3) ⇒ FALSE
TRUE TRUE() Returns the logical value TRUE IF(TRUE();1;2) ⇒ 1
FALSE FALSE() Returns the logical value FALSE IF(FALSE();1;2) ⇒ 2
IF IF(Test;Then;Else) Specifies a logical test to perform

- inputs can be linked to data

- result can be number, text, logical value

Result is number (bold inputs linked to data X[0;1;2;3;4;5;6]):

IF(220>200;220-200;200-220) ⇒ 20

IF(120>MAX([X⇕]);120;-1) ⇒ 120

IF(MAX([X⇓2:⇓3])>[X⇓7];MAX([X⇓2:⇓3]);[X⇓7])) ⇒ 6

IF(MAX(⟨1;2⟩)>6;MAX(⟨1;2⟩);6) ⇒ 6

Result is text:

Input [Coordinate Z] = 210;[GWT] = 180

IF([Coordinate Z]>0;"Above terrain";"Under terrain") ⇒ "Top above terrain"

IF([GWT]<[Coordinate Z];"GWT under top of the test.";"Measure error.") ⇒ "GWT under top of the test."

IFS IFS(Test1;Then1;Test2;Then2; ... ;Else) Checks whether one or more conditions are met and returns a value that corresponds to the first TRUE condition Input [GWT] = 15

IFS([GWT]>8;10;[GWT]>6;9;[GWT]>3;8;-1) ⇒ 10

NOT NOT(Boolean) Reverses the logic of its argument IF(NOT(5>6);175;155) ⇒ 175

IF(NOT(5>4);175;155) ⇒ 155

IF(NOT("A"="B");175;155)⇒ 175

SWITCH SWITCH(Switch;Case1;Result1;Case2;Result2; ... ;[ Else ]) Evaluates an expression against a list of values and returns the result corresponding to the first matching value. If there is no match, an optional default value may be returned SWITCH(50>6;TRUE();44;FALSE();56;-111) ⇒ 44

SWITCH(30/6;3;120;4;220;5;320;420) ⇒ 320

Mathematical

Name Syntax, parameters Description Example
ABS
ACOS
ACOT
ASIN
ATAN
COS
SIN
COT
TAN
EXP
LN
LOG
LOG10
PI
POWER
SQR
SQRT
SUM
DEG
RAD
ROUNDUP
ROUNDDOWN

Text

Name Syntax, parameters Description Example
CONCAT
LEFT
RIGHT
LENGTH
FIND

Statistical

Name Syntax, parameters Description Example
AVERAGE
MAX
MIN
PERCENTIL
STDEV
MODUS
MEDIAN

Matrix

Name Syntax, parameters Description Example
LINEARTREND
LINEARTRENDANDPOINTS
LINEARTRENDSC
LINEARTRENDSCANDPOINTS
LINEARTRENDTOPOINTS
SEMICIRCELTOPOINTS