Difference between revisions of "Core.Terms.ToBoolean"

From emotive
Jump to navigation Jump to search
Line 5: Line 5:
 
== OTL Syntax ==
 
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
BooleanTerm = ToBoolean(Term);
+
BooleanTerm ToBoolean(Term)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 17: Line 17:
 
*: Returns a copy of the value
 
*: Returns a copy of the value
 
* '''Integer'''
 
* '''Integer'''
*: If 0, return {{FontColor|blue||false}}, otherwise {{FontColor|blue||true}}
+
*: Returns {{FontColor|blue||false}} if 0, otherwise {{FontColor|blue||true}}
 
* '''Float'''
 
* '''Float'''
*: If 0.0, return {{FontColor|blue||false}}, otherwise {{FontColor|blue||true}}
+
*: Returns {{FontColor|blue||false}} if 0.0, otherwise {{FontColor|blue||true}}
 
* '''ByteField'''
 
* '''ByteField'''
*: If empty, return {{FontColor|blue||false}}, otherwise {{FontColor|blue||true}}
+
*: Returns {{FontColor|blue||false}} if empty, otherwise {{FontColor|blue||true}}
 
* '''String'''
 
* '''String'''
*: If the value of the string "True", and not taken into account - insensitive will return {{FontColor|blue||true}}, otherwise {{FontColor|blue||false}}
+
*: Returns {{FontColor|blue||true}} if the string value is "true", ignoring case, otherwise {{FontColor|blue||false}}
  
 
== Properties ==
 
== Properties ==
Line 36: Line 36:
 
Boolean Boolean2;
 
Boolean Boolean2;
 
Boolean Boolean3;
 
Boolean Boolean3;
 +
Boolean Boolean4;
 +
Boolean Boolean5;
  
Boolean1 = ToBoolean(0);
+
Boolean1 = ToBoolean(true);
Boolean2 = ToBoolean("true");
+
Boolean2 = ToBoolean(0);
Boolean3 = ToBoolean("false");
+
Boolean3 = ToBoolean(0.00001);
 +
Boolean4 = ToBoolean(&00);
 +
Boolean5 = ToBoolean("tRuE");
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 11:23, 2 May 2019

Classification

Name ToBoolean
Short Description Converts an OTX term to a value of the Boolean data type
Class Term
Extension OTX Core library
Group Conversion terms
Exceptions -
Checker Rules -
Standard Compliant Yes

OTL Syntax

BooleanTerm ToBoolean(Term)

Description

This term will return the Boolean counterpart of the argument term.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
Boolean Returns the Boolean counterpart of the argument term.

Rules

  • Boolean
    Returns a copy of the value
  • Integer
    Returns false if 0, otherwise true
  • Float
    Returns false if 0.0, otherwise true
  • ByteField
    Returns false if empty, otherwise true
  • String
    Returns true if the string value is "true", ignoring case, otherwise false

Properties

Name Data Type Class Default Cardinality Description
Term - Term - [1] Represents the OTX term that will be converted to a new value of the Boolean data type. See conversion rule descriptions above.

OTL Examples

Boolean Boolean1;
Boolean Boolean2;
Boolean Boolean3;
Boolean Boolean4;
Boolean Boolean5;

Boolean1 = ToBoolean(true);
Boolean2 = ToBoolean(0);
Boolean3 = ToBoolean(0.00001);
Boolean4 = ToBoolean(&00);
Boolean5 = ToBoolean("tRuE");

See also

ToInteger
ToFloat
ToByteField
ToString