Iconics Suite - Expressions syntax [Iconics Syntax]

Iconics Suite - Expressions syntax [Iconics Syntax]

This articles contains a lot of practical examples of expression syntaxes

Strings

Enclosed in " "
      - "Lorem ipsum dolor sit amet"
      - " as normal character only when string enclosed with $" "$
            - $"Text with " " inside"$

Combining text and numbers with tostring(), toformat() or concat()
      - "a" + "b" -> "ab"  1 + 2 -> 3  "1" + 2 + "3" -> 6
      - "a" + 1 -> Unsupported conversion (string -> double)
      - "a" + tostring(1) -> "a1"
      - "a" + toformat(1, "FORMAT") -> "a1“ 
      - concat("a", 1) -> "a1"

Valueof

Requesting value from string data point

x={{DataPoint}}    -> standard 
valueof:x="Data" + "Point"  -> DataPoint is built as string and then requested
x={{valueof:x="DataPoint" + {{valueof:x="AnotherDataPoint"}}}}  -> using result of valueof in another valueof

Examples
valueof:x="localsim:sine"
x={{valueof:x="localsim:sine"}}
valueof:x="bi:Models:Northwind(SELECT [Employees].[FirstName], [Employees].[LastName])[FirstName][" + tostring({{localsim::Row:UInt32}}) + "]"
valueof:x="db:Northwind.Employees[FirstName][" + tostring({{localsim::Row:UInt32}}) + "]"

Aliases

Global Aliases

<#GlobalAlias#>
- Handled on server side ->FrameWorX
- Scope:
      - Single or multiple displays -> Depending on level (/0, /1, /2, …)
      - Server-side modules -> Only aliases defined in Workbench
Alias value always set to whole display

Local aliases <<LocalAlias>>
- Handled on client side -> GraphWorX, AnyGlass
- Scope -> Single display only
- Alias value can be set to whole display or individual objects

Global aliases example
- #GlobalAliasName=value;#GlobalAliasName=value/level;
- #Alias1=setting;#Alias2=4/2;#Alias3=aliases/2;#Alias4=in 1 line;

Global themes
- GlobalThemeName=value;GlobalThemeName=value/level;
- Theme1=Preset1;Theme2=Preset2/2;#Alias1=value1;

Special characters & = / ;
- Escaped with &
- #GlobalAlias=value with special characters ‘&&, &=, &/, &;’;
- #GlobalAlias=ac:Asset&/Path&/;

Set global alias (examples)
-#GlobalAlias=value;
- {{x="#GlobalAlias=value;"}}
- {{x="#GlobalAlias=" + tostring({{DataPoint}})+ ";"}}
- {{x="#GlobalAlias=" + toformat({{DateTimePoint}}, "yyyy-MM-dd HH:mm:ss") + ";"}}
- {{x="#GlobalAlias=" + tostring({{<#AnotherGlobalAlias#>}}) + ";"}}
- {{x="#GlobalAlias=" + {{"<#AnotherGlobalAlias#>"}} + ";"}}
- {{x="#GlobalAlias=" + replace({{"<#AnotherGlobalAlias#>"}}, "/", "&/") + ";"}}
{{x="#GlobalAlias=" + replace(replace(replace(replace({{"<#AnotherGlobalAlias#>"}}, "&", "&&"), "/", "&/"), "=", "&="), ";", "&;") + ";"}}
- {{x="#GlobalAlias=<<LocalAlias>>;"}}  or  {{x=$"#GlobalAlias=<<LocalAlias>>;"$}}
- {{x="#GlobalAlias=" + replace($"<<LocalAlias>>"$, "/", "&/") + ";"}}
- {{x="#GlobalAlias=" + replace(replace(replace(replace($"<<LocalAlias>>"$), "&", "&&"), "/", "&/"), "=", "&="), ";", "&;") + ";"}}

Global alias value
- Handled by server side (FrameWorX)
- Requesting value in data source
      <#GlobalAlias#>  ac:Path/<#PartOfAssetPath#>/Property
- Requesting value in data source or expression
      {{<#GlobalAlias#>}}  {{ac:Path/<#PartOfAssetPath#>/Property}}
      x={{<#GlobalAlias#>}}  x={{ac:Path/<#PartOfAssetPath#>/Property}}
- Alias value as string in data source
      "<#GlobalAlias#>"  "text<#GlobalAlias#>text"
- Alias value as string in data source or expression
      {{"<#GlobalAlias#>"}}  {{"text<#GlobalAlias#>text"}}
      x={{"<#GlobalAlias#>"}}   x={{"text<#GlobalAlias#>text"}}

Empty global alias returns itself
x={{"<#GlobalAlias#>"}} == "<#GlobalAlias#>"
x=like({{"<#GlobalAlias#>"}}, "<#*#>", true)
Global alias levels (most useful)
#GlobalAlias=value; single display only (e.g. popup, side panel, …)
#GlobalAlias=value/2; all displays in current instance (GraphWorX window, single AnyGlass tab)
#GlobalAlias=value/1; all displays in current process (GraphWorX process, all AnyGlass tabs in single browser)

Local Aliases

- CSV format with , separator
- One alias per line
- Alias1,value of first alias
  Alias2,value of second alias
  Alias3,value of third alias
Special characters , "
- LocalAlias,"value with , must be enclosed in quotation marks"
- LocalAlias,"quotation marks "" inside value "" must be doubled"


Set local alias (examples)
LocalAlias,value
{{x="LocalAlias,value"}}
{{x="LocalAlias," + tostring({{DataPoint}})}}
{{x=“LocalAlias," + toformat({{DateTimePoint}}, "yyyy-MM-dd HH:mm:ss") + ";"}}
{{x="LocalAlias," + tostring({{<<AnotherLocalAlias>>}})}}
{{x="LocalAlias,<<AnotherLocalAlias>>"}}
{{x=$"LocalAlias,"<<AnotherLocalAlias>>""$}}
{{x="LocalAlias," + $""<<AnotherLocalAlias>>""$}}
{{x="LocalAlias," + replace($"<<AnotherLocalAlias>>"$, $"""$, $""""$)}}
{{x="LocalAlias," + tostring({{<#GlobalAlias#>}})}}
{{x="LocalAlias," + $"""$ + {{"<#GlobalAlias#>"}} + $"""$}}
{{x="LocalAlias," + $"""$ + replace({{"<#GlobalAlias#>"}}, $"""$, $""""$) + $"""$}}

Local alias value
- Handled by client side (GraphWorX, AnyGlass)
      Requesting value in data source
            <<LocalAlias>>  ac:Path/<<PartOfAssetPath>>/Property
- Requesting value in data source or expression
      {{<<LocalAlias>>}}  {{ac:Path/<<PartOfAssetPath>>/Property}}
      x={{<<LocalAlias>>}}  x={{ac:Path/<<PartOfAssetPath>>/Property}}
- Alias value as string in data source or expression
      {{"<<LocalAlias>>"}}  {{$"<<LocalAlias>>"$}}     {{"text<<LocalAlias>>text"}}
      x="<<LocalAlias>>"  x=$"<<LocalAlias>>"$  x="text<<LocalAlias>>text"
      x={{"<<LocalAlias>>"}}    x={{$"<<LocalAlias>>"$}}     x={{"text<<LocalAlias>>text"}}

Empty local alias returns itself or empty string
      x=$"<<LocalAlias>>"$ == "<"+"<"+"LocalAlias"+">"+">" || $"<<LocalAlias>>"$ == ""
      x=like($"<<LocalAlias>>"$, "<"+"<"+"*"+">"+">", true) || $"<<LocalAlias>>"$ == ""

localsim:property syntax

Object properties can be accessed with localsim:property syntax
- .NET reflection with read and/or write access
- Direct access with object name
      localsim:property:ObjectName.Property
- Relative access in the display structure
      localsim:property:@@self.Property  this object
      localsim:property:@@parent.Property  parent object
      localsim:property:@@ancestor[N].Property  parent object N levels up; @@ancestor[1] = @@parent
      Relative access works only with named objects
            ProcessPoint with data source localsim:property:@@ancestor[3].Name to get value Grid1

Objects and dynamics
      Grid1@@ancestor[3]
            Grid2@@ancestor[2]
                  ProcessPoint@@parent or @@ancestor[1]

Examples (basics)
localsim:property:@@self.Name  localsim:property:@@parent.Name
localsim:property:Source  localsim:property:GraphWorXViewer.Source
localsim:property:ViewportWidth  localsim:property:ViewportHeight
localsim:property:@@parent.Width  localsim:property:@@parent.Height
localsim:property:@@parent.ActualWidth  localsim:property:@@parent.ActualHeight
localsim:property:@@parent.Row  localsim:property:@@parent.Column
localsim:property:@@parent.RowSpan  localsim:property:@@parent.ColumnSpan

Clone Dynamic

- Dynamic generates N duplicates of the same object
- 2 parameters
      NumberOfInstances – how many duplicates
            Runtime point, expression
      InstanceNumberAliasName – local alias name identification (e.g. <<i>>)
            String
- Instances identified by number starting from 0
      5 instances
      <<i>> = 0, 1, 2, 3, 4

AssetWorX internal attributes
      .ChildEquipmentCount – number of child assets
      .ChildEquipmentNames – string[] with child assets names
      .ChildEquipmentPointNames – string[] with child assets point names (ac:Path/)
      .PropertyCount – number of asset properties
      .PropertyNames – string[] with asset properties names
      .PropertyPointNames – string[] with asset properties point names (ac:Path/Property)

Expression with valueof:x= and getat(array[], index) function
      valueof:x=getat({{ac:Path/.ChildEquipmentPointNames}}, <<i>>) + "PropertyName"
      valueof:x=getat({{ac:Path/.PropertyPointNames}}, <<i>>)

BI @@Count and [Column][Row]
      bi:Models.Model.Table.@@Count – number of rows in table
      bi:Models.Model(QUERY).@@Count – number of rows in result
      bi:Models.Model(QUERY)[Column][Row] – get single value from result
            Column – name or index
            Row – index (starting from 0)

Data source
      bi:Models.Model(SELECT [Table1].[Column1])[Column1][<<i>>]
      bi:Models.Model(SELECT [Table1].[Column1])[0][<<i>>]

GridWorX @@Count and [Column][Row]
      db:Database.DataSource.@@Count – number of rows in table
      db:Database.DataSource[Column][Row] – get single value from table
      Column – name or index
      Row – index (starting from 0)

Data source
      db:Database.DataSource[Column1][<<i>>]
      db:Database.DataSource[0][<<i>>]

CFSWorX internal attributes
      .ChildCount – number of child objects
      .ChildNames – string[] with child names
      .ChildPointNames – string[] with child point names
Expression with valueof:x= and getat(array[], index) function
      valueof:x=getat({{wa:Configuration/.ChildPointNames}}, <<i>>) + "Parameter"

Array
      localsim::Array:Object – local variable of type Object
            Generated with code block and createtypedarray(type, size) function
      <<Array>> - local alias with array() function
            Array,"array(0, 1, 2, 3, 4)"










Expressions with len(array[]) and getat(array[], index) function
      x=len({{localsim::Array:Object}})
      x=getat({{localsim::Array:Object}}, <<i>>)
      x=len(<<Array>>)
      x=getat(<<Array>>, <<i>>)

Security - RegEx (Regular Expressions)

Iconics Security module has option to check the write values with RegEx.

Examples:
^.* - you can input any amouth of any character
^[23] - you can input only character 2 or 3
^(23|24) - you can input only number 23 or 24