Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
createvalueobjectscripts [2020/09/22 09:24] wikiadmin |
createvalueobjectscripts [2021/10/11 19:27] (current) wikiadmin |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Creating VIB ValueObjects in Scripts ==== | + | ===== Creating VIB ValueObjects in Scripts |
Value Objects are the most common variable type within MIStudio and TransSECS. | Value Objects are the most common variable type within MIStudio and TransSECS. | ||
Line 43: | Line 43: | ||
</ | </ | ||
- | **Booleans** | + | ====Setting Value Object values==== |
+ | |||
+ | To set a value to a server (DataSource) in scripting, use set[ValueObjectType]Value(number or String). Note that the Server must be a " | ||
+ | |||
+ | For example: | ||
+ | |||
+ | |||
+ | <code JavaScript> | ||
+ | //set a Double (float) to a named Server | ||
+ | BroadcastServer-> | ||
+ | </ | ||
+ | |||
+ | Other set methods are for Int, | ||
+ | |||
+ | <code JavaScript> | ||
+ | BroadcastServer-> | ||
+ | BroadcastServer-> | ||
+ | BroadcastServer-> | ||
+ | BroadcastServer-> | ||
+ | </ | ||
+ | |||
+ | You can also use variables for the data. | ||
+ | |||
+ | <code JavaScript> | ||
+ | var pi=java.lang.Math.PI; | ||
+ | BroadcastServer-> | ||
+ | </ | ||
+ | |||
+ | ===Booleans=== | ||
<code JavaScript> | <code JavaScript> | ||
Line 51: | Line 79: | ||
'' | '' | ||
- | **Value Timestamp** | + | ===Value Timestamp=== |
<code JavaScript> | <code JavaScript> | ||
Line 65: | Line 93: | ||
Will return the time in milliseconds since Jan 01 1970. This is useful for time arithmetic. | Will return the time in milliseconds since Jan 01 1970. This is useful for time arithmetic. | ||
- | **Data Quality** | + | ===Data Quality=== |
ValueObjects always have a quality associated with them. The quality is an integer value. | ValueObjects always have a quality associated with them. The quality is an integer value. | ||
Line 82: | Line 110: | ||
</ | </ | ||
- | **Complex Types - Arrays and Tables** | + | ====Complex Types - Arrays and Tables==== |
One dimensional arrays are stored in //" | One dimensional arrays are stored in //" | ||
Line 104: | Line 132: | ||
</ | </ | ||
+ | ====Create a TwoDimensionalValueObject==== | ||
- | **Create a TwoDimensionalValueObject**. | + | TwoDVOs are used most often for tables and multi-line graphs. |
<code JavaScript> | <code JavaScript> | ||
Line 161: | Line 190: | ||
</ | </ | ||
- | **JavaScript JSON** | + | ====JavaScript JSON==== |
TransSECS devices will often use JSON to represent lists. | TransSECS devices will often use JSON to represent lists. | ||
Line 175: | Line 204: | ||
<code javascript> | <code javascript> | ||
JSON.parse(json); | JSON.parse(json); | ||
- | < | + | </code> |
Examples of converting from a Javascript object to Java types are available [[https:// | Examples of converting from a Javascript object to Java types are available [[https:// | ||