# Routine Operations

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page lists all of the routine operations available in Planimate as of 8.54.0. The operations all link to pages with their name but most of these pages will not exist. Where an operation warrants further discussion, these links can be followed and the pages created.

## Arithmetic

```\$R = Add(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### Clear

Set the target value to its initialising value

```\$R = CLEAR

\$R = Clear
```

### Dec ( -= )

Decrement first value/row/column/table by second value

```\$R -= \$1

\$R = Result
\$1 = Decr. by
```

### Div

Divide values/rows/columns/tables

```\$R = Div(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### Inc ( += )

Increment first value/row/column/table by second value

```\$R += \$1

\$R = Result
\$1 = Incr. by
```

### InterpolateValue

Interpolates a value between value1 and value2 based on ratio (0.0 gives value1, 1.0 gives value2)

```\$R = InterpolateValue(\$1,\$2,\$3)

\$R = Result
\$1 = Value1
\$2 = Value2
\$3 = Ratio
```

### Mul

Multiply values/rows/columns/tables

```\$R = Mul(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### RemapValue

Remaps value through table with row range, To Row = 0 uses row count

```\$R = RemapValue(\$1,\$2,\$3,\$4,\$5)

\$R = Result
\$1 = Map Table
\$2 = Value
\$3 = Map Column
\$4 = From Row
\$5 = To Row
```

### Scale ( *= )

Scale first value/row/column/table by second value

```\$R *= \$1

\$R = Result
\$1 = Scale by
```

### Set ( = )

Assign a value/row/column/table to another of the same type and size

```\$R = \$1

\$R = Result
\$1 = Set To
```

### Sub

Subtract two values/rows/columns/tables

```\$R = Sub(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

## Control

### BREAKLOOP

Immediately exits an ITERATE loop

```BREAKLOOP

```

### CASE

Tests a condition and if true, executes the code following until another CASE or DEFAULT is reached

```CASE (\$F)

\$F = CASE
```

### CONTINUE

Immediately processes the next iteration in a loop/while, skipping the rest of the code

```CONTINUE

```

### DEFAULT

Marks code that should be executed if no CASES match in a SELECT block

```DEFAULT

```

### ELSE

Enables an alternate block of code to execute if an IF test fails to be true

```ELSE

```

### ENDIF

Marks the end of an IF block

```ENDIF

```

### ENDLOOP

Marks the end of an ITERATE block

```ENDLOOP

```

### ENDSELECT

Marks the end of a SELECT block

```ENDSELECT

```

### ENDWHILE

Marks the end of a WHILE block

```ENDWHILE

```

### IF

Executes lines following only if the condition is true

```IF (\$F)

\$F = IF
```

### ITERATE

Repeats a block of routine lines, incrementing an attribute over a range

```ITERATE (\$R,\$1,\$2)

\$R = Index Using
\$1 = First Value
\$2 = Last Value
```

### ITERATEROWS

Iterate Row Index over all the rows in the table

```ITERATEROWS (\$R,\$1)

\$R = Row Index
\$1 = Table
```

### RETURN

Returns from the routine

```RETURN

```

### REVERSEITERATE

Iterate the result attribute over the given range in descending order

```REVERSEITERATE (\$R,\$1,\$2)

\$R = Index Using
\$1 = First Value
\$2 = Last Value
```

### SELECT

Starts a block where CASEs can be used to execute different code for conditions tested

```SELECT

```

### WHILE

Repeats a block of lines until the condition is false; the condition is tested first

```WHILE (\$F)

\$F = WHILE
```

## Display

### Animate

Animate a model object to a new screen position

```Animate(\$1,\$2,\$3)

\$1 = Object
\$2 = X Pos
\$3 = Y Pos
```

### ChooseColor

Enables selection of a colour

```\$R = ChooseColor(\$1)

\$R = Selected Colour
\$1 = Initial Colour
```

### ChoosePaletteColor

Shows the colour palette selector dialog to select a given palette colour

```\$R = ChoosePaletteColor(\$1)

\$R = Result
\$1 = Selection Color
```

### ColorPaletteEntry

Returns the RGB color for a given color index in the Planimate color palette

```\$R = ColorPaletteEntry(\$1)

\$R = Result
\$1 = Palette Index
```

### FitPanelToArea

Fits the panel to the area of its contents with a margin

```FitPanelToArea(\$1,\$2)

\$1 = Target Panel
\$2 = Margin
```

### ForceRepaint

Repaints all windows; use with care, it can cause slowdown

```ForceRepaint

```

### ForceRepaintPanel

Repaints the specified panel

```ForceRepaintPanel(\$1)

\$1 = Panel
```

### GetPanelProperty

Read a property of a panel, specified using _panel_properties list

```\$R = GetPanelProperty(\$1,\$2)

\$R = Result
\$1 = Panel
\$2 = Property Label
```

### GetSystemColorRGB

Returns the RGB color for a given color in the Windows system color palette

```\$R = GetSystemColorRGB(\$1)

\$R = Result
\$1 = Value
```

### GetViewportScrollX

Get the x scroll of a viewport on a given panel

```\$R = GetViewportScrollX(\$1,\$2)

\$R = Result
\$1 = Panel With Viewport
\$2 = Panel Inside Viewport
```

### GetViewportScrollY

Get the y scroll of a viewport on a given panel

```\$R = GetViewportScrollY(\$1,\$2)

\$R = Result
\$1 = Panel With Viewport
\$2 = Panel Inside Viewport
```

### GetViewportZoom

Get the zoom factor of a viewport on a given panel

```\$R = GetViewportZoom(\$1,\$2)

\$R = Result
\$1 = Panel With Viewport
\$2 = Panel Inside Viewport
```

### GraphXOffset

Read the offset of a graph view for a table on the given panel

```\$R = GraphXOffset(\$1,\$2)

\$R = Target
\$1 = Table
\$2 = Panel
```

### GraphXWidth

Read the width of a graph view for a table on the given panel

```\$R = GraphXWidth(\$1,\$2)

\$R = Target
\$1 = Table
\$2 = Panel
```

### HidePanel

Hides any popup for the given panel

```HidePanel(\$1)

\$1 = Target Panel
```

### HideTableEditor

Close any open table editor for the given table

```HideTableEditor(\$1)

\$1 = Table
```

### MakeVisible

Makes the specified panel the active panel on the main window

```MakeVisible(\$1)

\$1 = Target Subsystem
```

### PanelWindowLeft

Returns the left window co-ordinate of a popup panel

```\$R = PanelWindowLeft(\$1)

\$R = Result
\$1 = Panel
```

### PanelWindowTop

Returns the top window co-ordinate of a popup panel

```\$R = PanelWindowTop(\$1)

\$R = Result
\$1 = Panel
```

### PrintPanel

Queues the nominated panel for printing; additional panels can be printed by intercepting the _Panel Printed broadcast

```PrintPanel(\$1)

\$1 = Target Subsystem
```

### ReFitPopup

Resize an already open popup to panel's changed size

```ReFitPopup(\$1)

\$1 = Panel
```

### RepaintObjects

Initiates a repaint of dynamic object icons and the animation layer only; faster than a full force repaint and intended for animation. 'Panel' can be used to specify a viewport etc, if zero the current panel is used. If 'SpeedRegulate' is non zero, checks are performed to prevent successive repaints occurring faster than about 60 frames a second.

```RepaintObjects(\$1,\$2)

\$1 = Panel
\$2 = SpeedRegulate
```

### RepaintView

Repaints contents of a view

```RepaintView(\$1,\$2,\$3,\$4)

\$1 = Table
\$2 = Panel
\$3 = View Type
\$4 = Index
```

### SetActivityString

Sets text in the status bar activity area

```SetActivityString(\$1)

\$1 = Activity Text
```

### SetColorPaletteEntry

Sets the RGB color for a given color in the Planimate color palette

```SetColorPaletteEntry(\$1,\$2)

\$1 = Palette Index
\$2 = RGB Value
```

### SetGraphXOffset

Set the offset of a graph view for a table on the given panel

```SetGraphXOffset(\$1,\$2,\$3)

\$1 = Table
\$2 = Panel
\$3 = Value
```

### SetGraphXWidth

Set the width of a graph view for a table on the given panel

```SetGraphXWidth(\$1,\$2,\$3)

\$1 = Table
\$2 = Panel
\$3 = Value
```

### SetIconRemote

Set icon for an item somewhere else in the model. Location can be a portal or object id containing the item. If its 0 the entire model is searched, this is potentially very slow. Icon Name should not include any extention, PL will search DBs for it.

```SetIconRemote(\$1,\$2,\$3)

\$1 = Item ID
\$2 = Location
\$3 = Icon Name
```

### SetObjectPos

Sets the position and scaling of a dynamic object in one operation. The position is the centre of the object and the scaling is a percentage which should normally be 100 for no scaling.

```SetObjectPos(\$1,\$2,\$3,\$4,\$5)

\$1 = Object
\$2 = X Pos
\$3 = Y Pos
\$4 = X Scale
\$5 = Y Scale
```

### SetPanelColor

Sets the background color of a panel

```SetPanelColor(\$1,\$2)

\$1 = Panel
\$2 = Color
```

### SetPanelProperty

Set a property of a panel, specified using _panel_properties list

```SetPanelProperty(\$1,\$2,\$3)

\$1 = Panel
\$2 = Property Label
\$3 = Value
```

### SetPanelTransparency

Enables the use of transparency for a panel, value 0..254 or 255 to disable transparency

```SetPanelTransparency(\$1,\$2)

\$1 = Panel
\$2 = Transparency
```

### SetPortalIcon

Sets icon for portal's current state.

```SetPortalIcon(\$1,\$2)

\$1 = Portal ID
\$2 = Icon Name
```

### SetPortalTip

Sets tip text for Portal to Text

```SetPortalTip(\$1,\$2)

\$1 = Portal ID
\$2 = Text
```

### SetStatusItemAreaString

Sets the text in the status bar area where item class names are displayed during editing

```SetStatusItemAreaString(\$1)

\$1 = Item Area Text
```

### SetViewportScroll

Set the x and y scroll of a viewport on a given panel

```SetViewportScroll(\$R,\$1,\$2,\$3)

\$R = Panel With Viewport
\$1 = Panel Inside Viewport
\$2 = X Offset
\$3 = Y Offset
```

### SetViewportTarget

Set the target of a viewport. Current Panel identifies the viewport and can be zero of the containing panel only has 1 viewport. New Panel sets the new panel to display, 0 makes the viewport hidden in user mode.

```SetViewportTarget(\$1,\$2,\$3)

\$1 = Panel With Viewport
\$2 = Current Panel Inside Viewport
\$3 = New Panel Inside Viewport
```

### SetViewportZoom

Set the zoom factor of a viewport on a given panel

```SetViewportZoom(\$R,\$1,\$2)

\$R = Panel With Viewport
\$1 = Panel Inside Viewport
\$2 = Zoom Value
```

### SetWindowTitle

Sets the title of the main window

```SetWindowTitle(\$1)

\$1 = Title Text
```

```ShowAboutBox()

```

### ShowPopupPanel

Opens the given panel in a separate window at the specified window co-ordinates

```ShowPopupPanel(\$1,\$2,\$3)

\$1 = Target Panel
\$2 = X Position
\$3 = Y Position
```

### ShowTableEditor

Open table editor for the given table

```ShowTableEditor(\$1)

\$1 = Table
```

### SwapPopupPanel

Swaps which panels are visible in a popup panel without closing/reopening it

```SwapPopupPanel(\$1,\$2)

\$1 = Target Panel
\$2 = Replace With
```

## File

### AcquireFileLock

Returns zero if file lock acquired, otherwise if target is text its text is set to the lock failure reason

```\$R = AcquireFileLock(\$1,\$2)

\$R = Result
\$1 = File
\$2 = New Lock Text
```

### CopyFile

Copies file

```\$R = CopyFile(\$1,\$2)

\$R = Result
\$1 = From
\$2 = To
```

### CreateFolder

Create folder, if create path set then upper levels created as well

```\$R = CreateFolder(\$1,\$2)

\$R = Result
\$1 = File
\$2 = Create Path
```

### DeleteFile

Deletes file

```\$R = DeleteFile(\$1)

\$R = Result
\$1 = File
```

### DeleteFolder

Deletes empty folder, if subfolders set then empty subfolders also deleted

```\$R = DeleteFolder(\$1,\$2)

\$R = Result
\$1 = File
\$2 = Subfolders
```

### ExtractFileExtention

Extracts the file extention from a path/file spec. If Result is a label list attribute, and its value is 0 then a new label is added and Result gets assigned to the index, otherwise if its non zero the label indicated by the index is changed. If Result is text formatted, the text is set directly.

```\$R = ExtractFileExtention(\$1)

\$R = Result
\$1 = Path/File
```

### ExtractFileName

Extracts the file name from a full path/file spec. If Result is a label list attribute, and its value is 0 then a new label is added and Result gets assigned to the index, otherwise if its non zero the label indicated by the index is changed. If Result is text formatted, the text is set directly.

```\$R = ExtractFileName(\$1)

\$R = Result
\$1 = Path/File
```

### ExtractPathName

Extracts the file name from a full path/file spec. If Result is a label list attribute, and its value is 0 then a new label is added and Result gets assigned to the index, otherwise if its non zero the label indicated by the index is changed. If Result is text formatted, the text is set directly.

```\$R = ExtractPathName(\$1)

\$R = Result
\$1 = Path/File
```

### FileColumns

Number of columns in file or -1. Supports TAB or comma delimited data.

```\$R = FileColumns(\$1,\$2)

\$R = Result
\$1 = File
\$2 = Comma Delimit
```

### FileLines

Number of lines in file or -1

```\$R = FileLines(\$1)

\$R = Result
\$1 = File
```

### FilesInFolder

Reads a list of files in the path/folder and puts them into the target label list. The path can include a wildcard file name like c:\Data\*.txt

```\$R = FilesInFolder(\$1)

\$R = Target List
\$1 = Path/Wildcard
```

### FilesInHierarchy

Retrieves the files in all folders starting at Path/File, placing the path names into the target label list.

```\$R = FilesInHierarchy(\$1)

\$R = Target List
\$1 = Path/File
```

### FileSize

```\$R = FileSize(\$1)

\$R = Result
\$1 = File
```

### PlaySound

Play windows sound file. Will extract WAV files from DB if required.

```PlaySound(\$1,\$2)

\$1 = Sound File
\$2 = Wait Finish
```

Reads the reference from file. Data can be a direct reference or a data object label. Options can be a combination of values from the _fileoptions label list.

```\$R = ReadFromFile(\$1,\$2,\$3,\$4,\$5,\$6,\$7)

\$R = Result
\$1 = File
\$2 = Data
\$3 = Options
\$4 = File Row
\$5 = File Column
\$6 = Row Limit
\$7 = Column Limit
```

Reads file, following format of table view. The table reference can be direct or a data object. The options can be a combination of values from the _fileoptions label list.

```\$R = ReadViewFromFile(\$1,\$2,\$3,\$4,\$5)

\$R = Result
\$1 = File
\$2 = Table
\$3 = Panel
\$4 = View Index
\$5 = Options
```

### ReleaseFileLock

Returns zero if file lock is released (it must be yours to release) otherwise if target is text its text is set to the lock failure reason

```\$R = ReleaseFileLock(\$1)

\$R = Result
\$1 = File
```

### RenameFile

Renames file

```\$R = RenameFile(\$1,\$2)

\$R = Result
\$1 = From
\$2 = To
```

### RunCommand

Runs a new process or opens a file via the shell

```\$R = RunCommand(\$1,\$2,\$3,\$4,\$5)

\$R = Result
\$1 = Command
\$2 = Use shell
\$3 = Minimised
\$4 = Wait Complete
\$5 = Keep Front
```

### SaveImage

Saves the panel image to a file or to the clipboard if the file name is empty or “-”. A memory save creates/updates an icon in the icon cache that paint button states and object icons can use.

```\$R = SaveImage(\$1,\$2,\$3)

\$R = Result
\$1 = File
\$2 = Panel
\$3 = In-Memory
```

### WriteToFile

Writes the reference to file. Data can be a direct reference or a data object label. Options can be a combination of values from the _fileoptions label list.

```\$R = WriteToFile(\$1,\$2,\$3)

\$R = Result
\$1 = File
\$2 = Data
\$3 = Options
```

### WriteViewToFile

Writes table view to file. The table reference can be direct or a data object. The options can be a combination of values from the _fileoptions label list.

```\$R = WriteViewToFile(\$1,\$2,\$3,\$4,\$5)

\$R = Result
\$1 = File
\$2 = Table
\$3 = Panel
\$4 = View Index
\$5 = Options
```

## Label

Show a dialog so the user can add a label to the given label list

```AddLabelDialog(\$R)

\$R = Result
```

Makes the new sublabel for the parent label \$1 (if it doesn't exist) and returns its index as a sublabel

```AddSubLabel(\$R,\$1)

\$R = Result
\$1 = Label
```

### ClearLabelList

Removes all labels from a label list

```ClearLabelList(\$1)

\$1 = Clear Label List
```

### CreateLabelList

Creates a label list with the given name and formats the result attribute to reference it

```CreateLabelList(\$R,\$1)

\$R = Format Result
\$1 = List Name
```

### CreateLabelListFromColumn

Uses the provided column to provide text for creating a new label list

```CreateLabelListFromColumn(\$R,\$1)

\$R = Target List
\$1 = Source Column
```

### CreatePanelPortalLabel

Creates a panel label for the subsystem of the given portal object label

```\$R = CreatePanelPortalLabel(\$1)

\$R = New Panel Label
\$1 = Portal Object Label
```

### CreateSubLabelList

Creates an empty sub label list of an existing label list and formats an attribute to reference it

```CreateSubLabelList(\$R,\$1,\$2)

\$R = Format Result
\$1 = List Name
\$2 = Parent List
```

### CreateSubsystemObjectLabel

Creates an object label for the portal owning the panel of this routine

```\$R = CreateSubsystemObjectLabel()

\$R = New Object Label
```

### DeleteLabel

Deletes the given label from its labellist

```DeleteLabel(\$1)

\$1 = Label
```

### GetLabelListProperty

Retrieves a property of a label list

```\$R = GetLabelListProperty(\$1,\$2)

\$R = Result
\$1 = LabelList
\$2 = Property
```

### LabelCount

Returns how many labels in the given label list

```\$R = LabelCount(\$1)

\$R = Result
\$1 = Label Count
```

### MaxLabelIndex

Returns the highest allocated label index in the given label list

```\$R = MaxLabelIndex()

\$R = Result
```

### MinLabelIndex

Returns the lowest allocated label index in the given label list

```\$R = MinLabelIndex()

\$R = Result
```

### NextLabelIndex

The next allocated label index for the list or -1 if none

```\$R = NextLabelIndex(\$1)

\$R = Result
\$1 = Label Index
```

### PrevLabelIndex

The previous allocated label index for the list or -1 if none

```\$R = PrevLabelIndex(\$1)

\$R = Result
\$1 = Label Index
```

### RedirectLabelList

Globally changes all references to label list 'from' to point to list 'to'. Lists are referenced by name.

```RedirectLabelList(\$1,\$2)

\$1 = From Name
\$2 = To Name
```

### ReIndexLabelList

Re-indexes all members in a label list so they have ascending and continuous index values

```ReIndexLabelList(\$1)

\$1 = Re-index Label List
```

### ReIndexLabels

Remaps labels in the given list using 2 columns of matching from and to values

```ReIndexLabels(\$1,\$2,\$3)

\$1 = Re-index List
\$2 = From Values (Col)
\$3 = To Values (Col)
```

### RemoveSubLabel

Removes the sublabel as a member of the sublabel list

```RemoveSubLabel(\$1)

\$1 = Label
```

### SetLabelListProperty

Sets a property of a label list

```SetLabelListProperty(\$1,\$2,\$3)

\$1 = LabelList
\$2 = Property
\$3 = Value
```

### TestLabelIndex

Tests whether an index has been used in a label list

```\$R = TestLabelIndex(\$1,\$2)

\$R = Result
\$1 = Index Value
\$2 = Label List
```

## Label String

### AppendToLabel

Append text to an existing label. Result must be a label list formatted attribute. If its value is 0 then a new label is added and result gets assigned to the index, otherwise the label indicated by the index is changed.

```\$R = AppendToLabel(\$1)

\$R = Result
\$1 = Source
```

### CreateLabelAlias

Creates a label alias from 'Text' and adds it to the 'Target Label' which must be a label from a label list. Returns non zero if there was a problem creating the alias because 'Text' is already assigned to another label index.

```\$R = CreateLabelAlias(\$1,\$2)

\$R = Error Result
\$1 = Text
\$2 = Target Label
```

### CreateMD5Hash

Uses the 3 text sources to create an unpredictable hash string

```\$R = CreateMD5Hash(\$1,\$2,\$3)

\$R = Result
\$1 = Text
\$2 = Salt 1
\$3 = Salt 2
```

### CropToCharacters

Crop a label to a subset of its text

```CropToCharacters(\$R,\$1,\$2)

\$R = Result
\$1 = From Char
\$2 = To Char
```

### ExtractIntoFormat

Extracts a substring from a formatted value/label and interprets it in the format of the target. If the target is a label list, it gets added as a label if its not already in that list.

```\$R = ExtractIntoFormat(\$1,\$2,\$3)

\$R = Result
\$1 = Label
\$2 = From Char
\$3 = To Char
```

### FileSHA

Creates 64 character checksum for file using SHA256. If text_file is 1 then the file is expected to be text and CR characters, if present, are ignored.

```\$R = FileSHA(\$1,\$2)

\$R = Result
\$1 = File
\$2 = TextFile
```

### FormatIntoLabel

Create a new label with the formatted text of the source

```FormatIntoLabel(\$R,\$1)

\$R = Result
\$1 = Source
```

### FormatIntoLabelIndex

Creates a label from the text of source and using the provided index

```\$R = FormatIntoLabelIndex(\$1,\$2)

\$R = Result
\$1 = Source
\$2 = Index
```

### FormatNameIntoLabel

Creates a label from the name of the given object

```\$R = FormatNameIntoLabel(\$1)

\$R = Result
\$1 = Source
```

### FormattedLabelIndex

Determines if the source text is a label and returns its index if it is

```\$R = FormattedLabelIndex(\$1)

\$R = Result
\$1 = Source
```

### FormattedWidth

Returns how many characters the referenced data has when it is formatted for display

```\$R = FormattedWidth(\$1)

\$R = Target
\$1 = Width Of
```

### FormatTitleIntoLabel

Creates a label from the title text of the given object

```\$R = FormatTitleIntoLabel(\$1)

\$R = Result
\$1 = Source
```

### GetAppDataName

Get a full Users/username/AppData/Roaming path/file including a subfolder and a filename. If Result is text, it is set on success and set empty on failure, otherwise the path is placed in s.LastAccessedDataFilePath and this returns non zero if the folder was created/verified writeable.

```\$R = GetAppDataName(\$1,\$2)

\$R = Result
\$1 = Folder
\$2 = Filename
```

### GetCharacter

Extracts a character from the formatted value provided and returns the ascii code

```\$R = GetCharacter(\$1,\$2)

\$R = Target
\$1 = String
\$2 = Character
```

### GetMyDocumentsName

Get a full Users/username/Documents path/file including a subfolder and a filename. If Result is text, it is set on success and set empty on failure, otherwise the path is placed in s.LastAccessedDataFilePath and this returns non zero if the folder was created/verified writeable.

```\$R = GetMyDocumentsName(\$1,\$2)

\$R = Result
\$1 = Folder
\$2 = Filename
```

### GetProgramName

Get the folder containing the running Planimate EXE and append a filename. If Result is text, it is set to the path, otherwise the path is placed in s.LastAccessedDataFilePath and this returns non zero.

```\$R = GetProgramName(\$1)

\$R = Result
\$1 = Filename
```

### GetSharedAppDataName

Get a full ProgramData/AppData/Roaming/file including a subfolder and a filename. If Result is text, it is set on success and set empty on failure, otherwise the path is placed in s.LastAccessedDataFilePath and this returns non zero if the folder was created/verified writeable.

```\$R = GetSharedAppDataName(\$1,\$2)

\$R = Result
\$1 = Folder
\$2 = Filename
```

### LogMessage

Writes text to the debug logger window and the planimat.dbg file if either enabled. Text can be a text expression including attributes and labels as well as quoted text, combined with the & character.

```LogMessage(\$1)

\$1 = Text
```

### RemapName

Uses the model ini file remapping to remap text, typically used for filenames. Multiple components can be combined with | separating them.

```\$R = RemapName(\$1)

\$R = Result
\$1 = Source Text
```

### RemoveFileExtention

Crop label to remove trailing dot and text

```RemoveFileExtention(\$R)

\$R = Result
```

### RenameLabel

Change the text of a label. Result must be a label list formatted attribute. If its value is 0 then a new label is added and result gets assigned to the index, otherwise the label indicated by the index is changed.

```\$R = RenameLabel(\$1)

\$R = Result
\$1 = Source
```

### RenameObject

Sets the display name of an object. The name may be adjusted if it is not unique on the panel for that kind of object.

```RenameObject(\$1,\$2)

\$1 = Object
\$2 = New Name
```

### SetFreeTextTitle

Sets title of free text editor dialog

```SetFreeTextTitle(\$1)

\$1 = Title Text
```

## Logical

### BitAND

Treat values as integers and bitwise AND them (limited to 14 bits of precision)

```\$R = BitAND(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### BitOR

Treat values as integers and bitwise OR them (limited to 14 bits of precision)

```\$R = BitOR(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### BitXOR

Treat values as integers and bitwise XORs them (limited to 14 bits of precision)

```\$R = BitXOR(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### EQ ( == )

Determines if 2 values are numerically close to each other

```\$R = \$1 == \$2

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### GE ( >= )

Determines if the first value is greater than or equal to the second

```\$R = \$1 >= \$2

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### GT ( > )

Determines if the first value is significantly greater than the second value

```\$R = \$1 > \$2

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### LE ( <= )

Determines if the first value is less than or equal to the second

```\$R = \$1 <= \$2

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### LT ( < )

Determines if the first value is significantly less than the second value

```\$R = \$1 < \$2

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### NEQ ( != )

Determines if 2 values are not numerically close to each otherclose to each other

```\$R = \$1 != \$2

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

## Message

Sends a broadcast to the entire model. Options can be 0 or a combination of values from the Broadcast Options label list.

```Broadcast(\$1,\$2)

```

Sends a broadcast to a specified dynamic panel and all under it. Options can be 0 or a combination of values from the Broadcast Options label list.

```BroadcastScoped(\$1,\$2,\$3)

\$3 = Send To Subsystem
```

Sends a broadcast to a specified dynamic panel. Options can be 0 or a combination of values from the Broadcast Options label list.

```BroadcastToPanel(\$1,\$2,\$3)

\$3 = Send To Subsystem
```

### ImmediateMessage

Send a message whilst the item waits at the change object

```ImmediateMessage(\$1)

\$1 = Message Target
```

### ImmediateMessageNamed

Send a message to a specified portal with a specific name whilst the item waits at the change object

```ImmediateMessageNamed(\$1,\$2)

\$1 = Message Target
\$2 = Message Name
```

### ReleaseWaitingItem

Used to signal a waiting dispatcher on the target panel that a given item should be released

```\$R = ReleaseWaitingItem(\$1,\$2)

\$R = Result
\$1 = Item Index
\$2 = Scope Panel
```

### ReverseItemDirection

Searches spatial links for the item and if found, reverses the direction of the item

```\$R = ReverseItemDirection(\$1,\$2)

\$R = Result
\$1 = Item Index
\$2 = Scope Panel
```

## Numeric

### abs

Magnitude of a value, without the sign

```\$R = abs(\$1)

\$R = Result
\$1 = Value 1
```

### Convolve

Performs a convolution between two columns into a preallocated result column. This is useful for combining distributions.”

```Convolve(\$R,\$1,\$2)

\$R = Result
\$1 = Column 1
\$2 = Column 2
```

### fmod

Floating point modulus of \$1 over base \$2

```\$R = fmod(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### max

Determines the greater of 2 values

```\$R = max(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### min

Determines the lesser of 2 values

```\$R = min(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### mod

Integer modulus of \$1 over base \$2

```\$R = mod(\$1,\$2)

\$R = Result
\$1 = Value 1
\$2 = Value 2
```

### Normalise

Rescales data in column so they add up to 1

```Normalise(\$1)

\$1 = Column
```

### random

Random value between 0 and 1

```\$R = random(\$F)

\$R = Result
\$F = Set to
```

### round

Integer closest to the value

```\$R = round(\$1)

\$R = Result
\$1 = Round Value
```

### RoundToN

Round value to the specified number of digits of precision

```\$R = RoundToN(\$1,\$2)

\$R = Result
\$1 = Round Value
\$2 = Sig. Digits
```

### trunc

Integer equal or lower than the value

```\$R = trunc(\$1)

\$R = Result
\$1 = Truncate
```

## Paint

### BlendColors

Returns the resulting colour (always opaque) you would get if a black surface was painted with Color1 then Color2.

```\$R = BlendColors(\$1,\$2)

\$R = Result
\$1 = Color1
\$2 = Color2
```

### CopyPaintObject

Enables a paint object to be copied

```\$R = CopyPaintObject(\$1,\$2)

\$R = New Paint Label
\$1 = Original Paint Label
\$2 = Destination Panel
```

### CopyPaintProperties

Copies the graphical properties between paint objects

```CopyPaintProperties(\$1,\$2)

\$1 = Paint Object To Update
\$2 = Original Paint Object
```

### CreateTiles

Creates a tileset from an image. (0,0) is the center of image. Existing tileset file is deleted. Returns 0 on success.

```\$R = CreateTiles(\$1,\$2,\$3,\$4)

\$R = Result
\$1 = Image File
\$2 = Tile Set
\$3 = MaxZoom
\$4 = Margin Colour
```

### DeleteAllPaintObjects

Delete all paint objects on the given panel

```DeleteAllPaintObject(\$1)

\$1 = Target Panel
```

### DeleteInheritedPaintObjects

Removes all paint objects which inherit from a given panel

```DeleteInheritedPaintObjects(\$1,\$2)

\$1 = Target Pane
\$2 = Un Inherit Panel
```

### DeletePaintObject

Deletes a paint object

```DeletePaintObject(\$1,\$2)

\$1 = Paint Label
\$2 = With Inherited
```

### GetPaintProperty

Read a property of a paint object

```\$R = GetPaintProperty(\$1,\$2)

\$R = Result
\$1 = Paint Object Label
\$2 = Property Label
```

### InheritPaintObjects

Enables a panel to be populated with paint objects from another panel

```InheritPaintObjects(\$1,\$2)

\$1 = Target Panel
\$2 = Inherit From Panel
```

### InterpolateColor

Interpolates an RGB color between color1 and color2 based on ratio (0.0 gives color1, 1.0 gives color2)

```\$R = InterpolateColor(\$1,\$2,\$3)

\$R = Result
\$1 = Color1
\$2 = Color2
\$3 = Ratio
```

Associate a paint object to a parent so it tracks movement of the parent. Parent and linked are paint objects. Edge values determine which edge/corner is used (1..9, 1=topleft, 2=top, 3=topright etc). Options: 1 auto-delete linked paint object when parent becomes hidden.

```LinkPaintObjects(\$1,\$2,\$3,\$4,\$5,\$6,\$7)

\$1 = Parent
\$3 = Parent Edge
\$5 = Offset X
\$6 = Offset Y
\$7 = Options
```

### LongLatToXY

Using the Map paint object, Longitude/Latitude co-ordinates are translated to panel X/Y points. Table must contain columns _Long, _Lat, _X and _Y

```LongLatToXY(\$1,\$2)

\$1 = Paint Map Label
\$2 = Table
```

### MakeRangeVisible

Adjusts the map co-ordinates to make the range of co-ordinates visible regardless of the map view's aspect ratio

```MakeRangeVisible(\$1,\$2,\$3,\$4,\$5)

\$1 = Paint Map Label
\$2 = Long From
\$3 = Lat From
\$4 = Long To
\$5 = Lat To
```

### PositionPaintObject

Move a paint object given a parent's position. Parent and Paint are paint objects. Edge values determine which edge/corner is used (1..9, 1=topleft, 2=top, 3=topright etc). Parent=0 uses panel edge.

```PositionPaintObject(\$1,\$2,\$3,\$4,\$5,\$6)

\$1 = Parent
\$2 = Paint
\$3 = Parent Edge
\$4 = Paint Edge
\$5 = Offset X
\$6 = Offset Y
```

### RepaintPaintObject

Repaint a single paint object. Useful if the object's contents have changed but it hasn't moved or changed size. Clear colour can be used to erase under the paint object when anti-aliasing causes blending noise to linger.

```RepaintPaintObject(\$1,\$2)

\$1 = Paint Label
\$2 = Clear Color
```

### ScaleColor

Scales the R/G/B components of a colour by Scale and adds Offset to each. Scale and Offset are normally 0..255. The alpha is unchanged.

```\$R = ScaleColor(\$1,\$2,\$3)

\$R = Result
\$1 = Color
\$2 = Scale
\$3 = Offset
```

### SetLongLatXY

Sets paint map to show the given co-ordinate as close as possible to the panel (x,y) point.

```SetLongLatXY(\$1,\$2,\$3,\$4,\$5)

\$1 = Paint Map Label
\$2 = Longitude
\$3 = Latitude
\$4 = X
\$5 = Y
```

### SetNoteVisible

Shows or hides an RTF note

```SetNoteVisible(\$1,\$2)

\$1 = Paint Object Label
\$2 = Visibility
```

### SetPaintImage

Sets the image of a paint object

```SetPaintImage(\$1,\$2)

\$1 = Paint Object Label
\$2 = Set Image To
```

### SetPaintProperty

Set a property of a paint object directly

```SetPaintProperty(\$1,\$2,\$3)

\$1 = Paint Object Label
\$2 = Property Label
\$3 = Property Value
```

### SetPaintText

Sets the text of a paint object

```SetPaintText(\$1,\$2,\$3)

\$1 = Paint Object Label
\$2 = Set Text/File To
\$3 = For All States
```

### SetPaintTip

Sets the tool tip text of a paint object

```SetPaintTip(\$1,\$2,\$3)

\$1 = Paint Object Label
\$2 = Set Tip To
\$3 = For All States
```

### SetPaintXY

Moves a paint object so a given edge/corner is at (X,Y). Edge=1..9 (1=topleft, 2=topcenter, 5=center, 7=bottomleft etc.)

```SetPaintXY(\$1,\$2,\$3,\$4)

\$1 = Paint Object Label
\$2 = X Pos
\$3 = Y Pos
\$4 = Edge
```

### SetTransparency

Sets the transparency (alpha) value of a colour

```\$R = SetTransparency(\$1,\$2)

\$R = Result
\$1 = Color
\$2 = Transparency
```

### XYToLongLat

Using the Map paint object, screen X/Y points are translated to Longitude/Latitude co-ordinates. Table must contain columns _Long, _Lat, _X and _Y

```XYToLongLat(\$1,\$2)

\$1 = Paint Map Label
\$2 = Table
```

## Pipe

Creates a pipe between From and To if one doesn't exist and allocates an object label for the new pipe, which is returned. If Copy Pipe is a valid pipe object label then its properties are copied.

```\$R = AddPipe(\$1,\$2,\$3)

\$R = New Pipe
\$1 = From
\$2 = To
\$3 = Copy Pipe
```

### RemovePipe

Removes any pipe between portals From and To (non directional). If From is a pipe label then it is used and To is ignored.

```RemovePipe(\$1,\$2)

\$1 = From
\$2 = To
```

## Route

Adds a new static route with given name and ID. The route steps start at the starting_cell, working down for step_count. Fill_steps determines if steps are filled after adding the route. If a route with the ID already exists, it is replaced. If ID is 0, a new ID gets allocated. Returns the ID of the route that gets created/modified (>0) or <0 on failure. Do not replace a static route which is being used by any items.

```\$R = AddStaticRoute(\$1,\$2,\$3,\$4,\$5)

\$R = Result
\$1 = Name
\$2 = Route ID
\$3 = Starting Cell
\$4 = Step Count
\$5 = Fill Steps
```

Creates a track between From and To if one doesn't exist and an object label is created and returned for the new track section.

```\$R = AddTrack(\$1,\$2,\$3)

\$R = New Track
\$1 = From
\$2 = To
\$3 = Track Type
```

### AssignRoute

Sets an item's track route from a route table

```AssignRoute(\$1)

\$1 = Timetable Source
```

### AssignRouteFrom

Sets an item's track route from locations specified by cells working down from start, stopping when either count is reached or a zero cell. Returns 0 if no error.

```\$R = AssignRouteFrom(\$1,\$2)

\$R = Result
\$1 = Starting Cell
\$2 = Step Count
```

### CancelLoopEntryDelay

Cancels a loop entry delay which is initiated for any item that may dwell at a location and is normally cancelled only if the item leaves the location immediately. This enables just a loop exit delay to occur without an associated loop entry delay.

```CancelLoopEntryDelay()

```

### ClearRoute

Clear an item's routing database

```ClearRoute()

```

### ClearTrailList

Clears a train's history of sections it has traversed

```ClearTrailList()

```

### CreateRoute

Creates a route of all steps between the two locations. Returns non zero and sets s.TrackFillRouteError on error.

```\$R = CreateRoute(\$1,\$2)

\$R = Result
\$1 = From
\$2 = To
```

### EnableTrackCheckNext

Used during lookahead, this enables a modeller to signal objects downstream of a lookahead that the current lookahead is for track capacity purposes and wont be taken immediately. It automatically resets when lookahead unwinds behind the routine.

```EnableTrackCheckNext()

```

### FillRouteSteps

Fills in all intermediate portals in an item's track route. Returns non zero on error in which case s.FillRouteError is set to a description

```\$R = FillRouteSteps()

\$R = Result
```

### GenerateTrackTable

Updates the Track Network Details table for the panel inside portal Location. This can change the rows in the track table. Result is non zero if an error occured.

```\$R = GenerateTrackTable(\$1)

\$R = Result
\$1 = Location
```

Places the road of a track section into waiting for an item state, preventing any other item using it. If Item ID is >= 0 it is used for the item ID otherwise the current item is used. Item Object is used to locate the item if Item ID is set.

```HoldSectionRoad(\$1,\$2,\$3,\$4)

\$1 = SectionID
\$3 = Item ID
\$4 = Item Object
```

### InsertRouteStep

Insert a track route step into an item's internal routing database

```InsertRouteStep(\$1,\$2)

\$1 = Route Step
\$2 = Route Location
```

### ListBlockedTrains

Clears table and adds a row for each blocked train. Columns are filled in this order: Item ID, Blocked Time, Blocked Location

```ListBlockedTrains(\$1)

\$1 = Table
```

Reads an item's track route into a table

```ReadRoute(\$R)

\$R = Timetable Target
```

### RegisterBlockedTrain

Register the item (train) into the track blocked list

```RegisterBlockedTrain()

```

### RemoveStaticRoute

Removes any static route with the given ID. Do not remove a static route which is being used by any items.

```RemoveStaticRoute(\$1)

\$1 = Route ID
```

### RemoveTrack

Removes any track between portals From and To. If From is a track label then it is used and To is ignored.

```RemoveTrack(\$1,\$2)

\$1 = From
\$2 = To
```

### ResetLoopDelayTime

Resets the loop entry time for an item, useful for enabling some time to be spent in a track location without a loop exit delay being triggered. This does not affect any loop entry delay under way, it will complete at its scheduled time.

```ResetLoopDelayTime()

```

Returns how many roads a given track section has been configured for

```\$R = RoadsInTrackSection(\$1)

\$R = Target
\$1 = Section
```

Returns where a track section road is available for an item/train to use

```\$R = SectionRoadAvail(\$1,\$2)

\$R = Result
\$1 = SectionID
```

Returns item ID of train in a track section road or -1 if no item

```\$R = SectionRoadTrain(\$1,\$2)

\$R = Result
\$1 = SectionID
```

### SetPreviousTailData

Enables taildata to be set for a road/length multiserver that a train has just left. This is useful when taildata information is not known until the front of the train leaves the road/multiserver. WhichData is 1..4 (TailData1..TailData4).

```SetPreviousTailData(\$1,\$2)

\$1 = WhichData
\$2 = Value
```

This will use road #'s specified by the column starting at a given cell to determine roads to test in lookahead on a track. It stops on a zero cell.

```SetRoadCheckFilter(\$1)

\$1 = Start Cell
```

Sets color of road in track section

```SetRoadColor(\$1,\$2,\$3)

\$1 = SectionID
\$3 = Color
```

### TrackSectionType

Returns the type of a track section (_section_types label list)

```\$R = TrackSectionType(\$1)

\$R = Target
\$1 = Section
```

### UnblockTrain

Attempt unblock of specific train id or all blocked trains if id is 0

```UnblockTrain(\$1)

\$1 = Item ID
```

### UpdateLoopEntryDelay

Sets the loop entry delay to a new value. This can be performed when a train enters a location. The delay is measured from when the original loop delay started. If no loop delay is active, the operation does nothing.

```UpdateLoopEntryDelay(\$1)

\$1 = Loop Delay
```

## Row/Column

### Average

Determines the average of values in a row or column

```\$R = Average(\$1,\$2,\$3)

\$R = Result
\$1 = Average of
\$2 = From
\$3 = To
```

### MaxIndex

Determines the index of the highest value in a row or column

```\$R = MaxIndex(\$1,\$2,\$3)

\$R = Result
\$1 = Max of
\$2 = From
\$3 = To
```

### MinIndex

Determines the index of the lowest value in a row or column

```\$R = MinIndex(\$1,\$2,\$3)

\$R = Result
\$1 = Min of
\$2 = From
\$3 = To
```

### StdDev

Determines the Standard Deviation of values in a row or column

```\$R = StdDev(\$1,\$2,\$3)

\$R = Result
\$1 = StdDev of
\$2 = From
\$3 = To
```

### Sum

Determines the sum of values in a row or column

```\$R = Sum(\$1,\$2,\$3)

\$R = Result
\$1 = Sum of
\$2 = From
\$3 = To
```

### SumSquared

Determines the sum of squares of values in a row or column

```\$R = SumSquared(\$1,\$2,\$3)

\$R = Result
\$1 = Sum/Sqr of
\$2 = From
\$3 = To
```

## Scientific

### arccos

```\$R = arccos(\$1)

\$R = Result
\$1 = Value
```

### arcsin

```\$R = arcsin(\$1)

\$R = Result
\$1 = Value
```

### arctan

```\$R = arctan(\$1)

\$R = Result
\$1 = Value
```

### atan2

Determines angle (in radians) given x and y displacement

```\$R = atan2(\$1,\$2)

\$R = Result
\$1 = Numerator (Y)
\$2 = Denominator (X)
```

### cos

```\$R = cos(\$1)

\$R = Result
\$1 = Value
```

```\$R = DegToRad(\$1)

\$R = Result
\$1 = Value
```

### exp

Calculates \$1 to the power of E

```\$R = exp(\$1)

\$R = Result
\$1 = Value
```

### hypot

Hypotenuse of right angled triangle with given sides

```\$R = hypot(\$1,\$2)

\$R = Result
\$1 = X Value
\$2 = Y Value
```

### log10

Calculates the decimal logarithm of the value

```\$R = log10(\$1)

\$R = Result
\$1 = Value
```

### logN

Calculates the natural logarithm of the value

```\$R = logN(\$1)

\$R = Result
\$1 = Value
```

### pow

Calculates \$1 to the power of \$2

```\$R = pow(\$1,\$2)

\$R = Result
\$1 = Value
\$2 = Power
```

```\$R = RadToDeg(\$1)

\$R = Result
\$1 = Value
```

### sin

```\$R = sin(\$1)

\$R = Result
\$1 = Value
```

### sqr

Value multiplied by itself

```\$R = sqr(\$1)

\$R = Result
\$1 = Value
```

### sqrt

Square root of value

```\$R = sqrt(\$1)

\$R = Result
\$1 = Value
```

### tan

```\$R = tan(\$1)

\$R = Result
\$1 = Value
```

Adds a bend point to a spatial link between the two objects specified

```AddBendPoint(\$R,\$1,\$2,\$3)

\$R = From Object
\$1 = To Object
\$2 = X Position
\$3 = Y Position
```

Adds a spatial link between objects which can only be traversed in the forward direction

```\$R = AddDirectionalLink(\$1,\$2)

\$1 = From Object
\$2 = To Object
```

```\$R = AddLink(\$1,\$2)

\$1 = From Object
\$2 = To Object
```

Instructs Planimate to update spatial link information after links are created or objects are moved

```ClearLinkCache()

```

```\$R = CopyLink(\$1,\$2,\$3)

\$1 = From Object
\$2 = To Object
```

Deletes all spatial links on a given panel

```DeletePanelLinks(\$1)

\$1 = Panel
```

### GetBendPoints

Reads bend points into table Bend Table. Link Type determines the type of link acted on. Bend Table Columns: from, to, x, y. Link Type: from _link_types label list.

```GetBendPoints(\$1,\$2,\$3)

\$1 = Bend Table
\$2 = Panel
```

Returns the next portal object index that an item will travel to on a spatial link given the item starting at 'from' and target 'to'. Returns 0 if none.

```\$R = GetNextLinkObject(\$1,\$2)

\$R = Location
\$1 = From Portal
\$2 = To Portal
```

Sets table to rows describing every item on the link. Required columns are ItemID, TotalTime, Ratio, Direction and Stopped. Ratio corresponds to the position on the link, 0 being the start of the link and 1 being the end. Direction is 0 for forward and 1 for reverse.

```QueryLinkItems(\$1,\$2)

\$1 = Table
```

Removes any spatial links from and to the specified object labels (directional)

```RemoveLink(\$1,\$2)

\$1 = From Object
\$2 = To Object
```

### SetBendPoints

Deletes all bend points and recreates them from the Bend Table. Link Type determines the type of link acted on. Bend Table Columns: from, to, x, y. Link Type: from _link_types label list.

```SetBendPoints(\$1,\$2,\$3)

\$1 = Bend Table
\$2 = Panel
```

Sets the destination an item will look for once it enters a spatial link. Time sets the travel time to use (or SetItemLinkTime can be used after this). Road sets the road for multi-toad links, 1..n or 0 to leave unchanged.

```SetItemLinkTarget(\$1,\$2,\$3)

\$1 = Target Object
\$2 = Total Time
```

Sets the time an item will take to reach its destination once it enters a spatial link

```SetItemLinkTime(\$1)

\$1 = To Time
```

Sets the color of a spatial link between 2 given objects

```SetLinkColor(\$1,\$2,\$3,\$4)

\$1 = From Object
\$2 = To Object
\$3 = Color
```

```SetLinkCost(\$1,\$2,\$3)

\$1 = From Object
\$2 = To Object
\$3 = Cost
```

```SetLinkRoads(\$1,\$2,\$3,\$4)

\$1 = From Object
\$2 = To Object
\$4 = Spacing
```

Sets the width of a spatial link between two objects

```SetLinkWidth(\$1,\$2,\$3)

\$1 = From Object
\$2 = To Object
\$3 = Width
```

Updates the spatial link items according to the settings in the table. Columns are ItemID, TotalTime, Ratio, Direction and Stopped. Ratio corresponds to the position on the link, 0 being the start of the link and 1 being the end. Direction is 0 for forward and 1 for reverse. Stopped enables just that item to be suspended on the link. If ItemID is -1 the row is ignored. If Ratio is -1, the items position is retained. If TotalTime is -1, the current total time for the item is retained.

```UpdateLinkItems(\$1,\$2)

\$1 = Table
```

## Special

### ---| Only During Move |---

Enables the modeller to specifically mark that the following routine lines do not execute during lookahead

``` Only During Move |---||----- Following Only During Move -----|

```

### Beep

Plays a tone through the sound card, Frequency in Hz, Duration in milliseconds

```Beep(\$1,\$2)

\$1 = Frequency
\$2 = Duration
```

### BREAKPOINTIF

If the parameter is true, this interrupts the routine and displays a debugging dialog enabling inspection of the models state

```BREAKPOINTIF (\$1)

\$1 = Enable Break
```

### BrowseKey

Give user chance to browse for another key. Returns non zero if a different key was selected which is acceptable.

```\$R = BrowseKey()

\$R = Result
```

### CallRoutine

Calls a subroutine

```CallRoutine(\$F)

\$F = Call
```

### Comment (//)

A comment line

```Comment

```

### CopyFont

Copies the font properties between cells and columns

```CopyFont(\$R,\$1)

\$R = Format Result
\$1 = Format From
```

### CopyFormat

Copies the format/unit type/label reference between cells, columns and attributes

```CopyFormat(\$R,\$1)

\$R = Format Result
\$1 = Format From
```

### CopyPortal

Makes a copy of a portal and places it on Panel. If the name text is not “-” or an empty string, the new portal uses that name.

```\$R = CopyPortal(\$1,\$2,\$3,\$4,\$5)

\$R = New Portal
\$1 = Original Portal
\$2 = New Panel
\$3 = X
\$4 = Y
\$5 = New Name
```

### DescribeRoutineData

Describe the data accessed by a change object routine

```DescribeRoutineData(\$1,\$2,\$3)

\$1 = Routine Panel
\$2 = Object Name
\$3 = Output Filename
```

### DragGanttBlock

Initiates dragging a gantt block. Should be invoked as result of gantt block click (set option to process event immediately). Returns non zero if block was moved and corresponding rows in table changed. Table data may need resorting if block moved beyond other block on same row. Drag Type can be as returned from the click broadcast, 1 = left edge, 2 = right edge, 3 = center (move only).

```\$R = DragGanttBlock(\$1,\$2,\$3,\$4,\$5,\$6,\$7,\$8)

\$R = Result
\$1 = Table
\$2 = Panel
\$3 = Drag Type
\$4 = Start Row
\$5 = End Row
\$6 = Min Time
\$7 = Max Time
\$8 = Increment
```

### EncodeARGB

Encodes alpha, red, green and blue components (0..255) into a single 4 byte value used to specify any color/transparency in Planimate.

```\$R = EncodeARGB(\$1,\$2,\$3,\$4)

\$R = Result
\$1 = Alpha Value
\$2 = Red Value
\$3 = Green Value
\$4 = Blue Value
```

### EncodeRGB

Encodes red, green and blue components (0..255) into a single 4 byte value used to specify any color in Planimate. The top byte of the value (alpha) is set to 255.

```\$R = EncodeRGB(\$1,\$2,\$3)

\$R = Result
\$1 = Red Value
\$2 = Green Value
\$3 = Blue Value
```

### FollowItemRemote

Searches spatial links for the item and if found, sets the 'followitem property.

```\$R = FollowItemRemote(\$1,\$2,\$3)

\$R = Result
\$1 = Item Index
\$2 = Scope Panel
```

### FormatForList

Formats the result object to reference a label list with the given name

```FormatForList(\$R,\$1)

\$R = Format Result
\$1 = List Name
```

### GetFormat

Returns the value format of the data

```\$R = GetFormat(\$1)

\$R = Result
\$1 = Data To Test
```

### GetFormatListName

Creates a new label with the name of the label list the target is formatted to. If no list, no change to the target is made

```GetFormatListName(\$R,\$1)

\$R = Result
\$1 = Data To Test
```

### InfoPanelRemote

Searches spatial links for the item and if found, sets the s.ItemShowInfoPanel property.

```\$R = IntoPanelRemote(\$1,\$2,\$3)

\$R = Result
\$1 = Item Info
\$2 = Scope Panel
\$3 = Show State
```

### ListRoutineCode

Write a change object routine code to a file

```ListRoutineCode(\$1,\$2,\$3)

\$1 = Routine Panel
\$2 = Object Name
\$3 = Output Filename
```

```\$R = LoadDataSet2(\$1,\$2,\$3)

\$R = Result
\$1 = Definition Table
\$2 = File Name
\$3 = Pass Phrase
```

Stops current run and loads another model. For PBA, the PBA is reloaded regardless of name.

```LoadModel(\$1)

\$1 = Model Name
```

### ObjectType

Returns the type of the object that the object label refers to

```\$R = ObjectType(\$1)

\$R = Result
\$1 = Object
```

### QueryNetwork

Sets table to rows describing every link on Panel between portals (track,spatial,pipe). 4 columns are required; From, To, Type and ID. From and To are the object Ids of the portals at the end points. Type is the type of link and is formatted to the “_link_type” label list. ID is the object id of the link.

```QueryNetwork(\$1,\$2)

\$1 = Table
\$2 = Panel
```

### RealTimeCallBack

This will schedule a _Real Time Tick broadcast at a given real interval, in milliseconds. Note that any previous event is cancelled when this is re-invoked. Interval can be between 10 and 5000ms.

```RealTimeCallBack(\$1)

\$1 = Interval (ms)
```

### RemovePortal

Deletes the portal and its contents from the model

```RemovePortal(\$1)

\$1 = Portal ID
```

### SaveDataSet2

Save a version 2 dataset

```\$R = SaveDataSet2(\$1,\$2,\$3)

\$R = Result
\$1 = Definition Table
\$2 = File Name
\$3 = Pass Phrase
```

### SetDirectory

Sets the working directory for the model. Use only for compiled applications. Returns non zero on failure

```\$R = SetDirectory(\$1)

\$R = Result
\$1 = Path
```

### SetFormat

Sets format of \$1 to mode \$2, with \$3 being the label list name if its a label format

```SetFormat(\$1,\$2,\$3)

\$1 = Data To Set
\$2 = Format
\$3 = List Name
```

### SetLastDatasetFile

Sets the last dataset filename, optionally visible in the titlebar. A relative filename will have a full path created as would be used in a file operation with the name.

```SetLastDatasetFile(\$1)

\$1 = Name
```

### ShowHelp

Open a HTML help window. Help File can be empty for default.

```ShowHelp(\$1,\$2)

\$1 = Help File
\$2 = Section
```

### SignFile

Digitally signs a file.

```\$R = SignFile(\$1,\$2,\$3,\$4,\$5)

\$R = Result
\$1 = File Name
\$2 = Cert
\$4 = Subject
\$5 = Time Server
```

### StartScheduledEntries

Signals that scheduled entries should start (if options deferred them starting when the model was run)

```StartScheduledEntries

```

Add portal, routine or item attribute to watch list for debugging

```WatchListAdd(\$1)

\$1 = Attribute
```

### WatchListRemove

Remove portal, routine or item attribute from watch list

```WatchListRemove(\$1)

\$1 = Attribute
```

## String

### GetNoteRTF

Retrieves RTF text of note

```\$R = GetNoteRTF(\$1)

\$R = String
\$1 = Paint ID
```

### GetNoteText

Retrieves plain text of note

```\$R = GetNoteText(\$1)

\$R = String
\$1 = Paint ID
```

### SetNoteRTF

Sets RTF text of note

```SetNoteRTF(\$1,\$2)

\$1 = Paint ID
\$2 = Text
```

### SetNoteText

Sets plain text of note

```SetNoteText(\$1,\$2)

\$1 = Paint ID
\$2 = Text
```

### SetText ( \$= )

Set a free text attribute or table cell to another text attribute, literal text or a the formatted text of a value

```\$R \$= \$1

\$R = Result
\$1 = Set To
```

## Table

Adds table to panel, returning data object label. If a table with that name already exists, 0 is returned.

```\$R = AddTable(\$1,\$2)

\$R = Result
\$1 = Panel
\$2 = Name
```

Performs a sort on a table using another table to define the sort criteria

```AdvancedSort(\$R,\$1)

\$R = Target
\$1 = Sort Info
```

### AllocateTableRowMemory

Enables memory to be reserved for a table which is expected to grow to a large number of rows

```AllocateTableRowMemory(\$R,\$1)

\$R = Target Table
\$1 = Allocate Rows
```

### AppendColumn

Append a column to a table

```AppendColumn(\$R,\$1)

\$R = Target
\$1 = Col Count
```

### AppendRow

Append a row to the table

```AppendRow(\$R,\$1)

\$R = Target
\$1 = Row Count
```

### BinarySearch

Perform a binary search over the range First Index to Last Index. Assumes the data compared is sorted ascending and the comparison is for equality. Multiple comparisons can be combined only with AND. Returns 1 + last index or 0 if Zero On Fail is set.

```\$R = BinarySearch(\$F,\$1,\$2,\$3)

\$R = Result
\$1 = First Index
\$2 = Last Index
\$3 = Zero On Fail
\$F = Condition
```

### BlockMove

Block copy a range of cells to another table

```BlockMove(\$R,\$1,Range[\$2][\$3])

\$R = Result
\$1 = Source
\$2 = # of Rows
\$3 = # of Cols
```

### CheckTableSorted

Determines if a table is sorted by the sort criteria. Return 0 if OK or the first unsorted row number. This can be more efficient than calling Sort which is very slow if the table is already sorted.

```\$R = CheckTableSorted(\$1,\$2,\$3,\$4,\$5)

\$R = Result
\$1 = Table
\$2 = Column 1
\$3 = Column 2
\$4 = Column 3
\$5 = Column 4
```

### CompareTables

Compares rows in tables, returns row number of first difference. Only numerical values are compared, not Text strings.

```\$R = CompareTables(\$1,\$2)

\$R = Result
\$1 = Table 1
\$2 = Table 2
```

### CopyToClipboard

Copy table to clipboard using its clipboard settings and the option modifiers

```CopyToClipboard(\$R,\$1)

\$R = From Table
\$1 = Options
```

### CountIFMatch

Counts rows where Match Column matches Match Key

```\$R = CountIFMatch(\$1,\$2)

\$R = Result
\$1 = Match Column
\$2 = Match Key
```

### CreateSortIndex

Creates an ordered list of row numbers if the given column was sorted alphabetically

```CreateSortIndex(\$R,\$1)

\$R = Target Column
\$1 = Column To Sort
```

### DeleteColumn

Delete a range of columns from a table

```DeleteColumn(\$R,\$1,\$2)

\$R = Target Table
\$1 = First Col
\$2 = Col Count
```

### DeleteRow

Delete a number of rows starting at a given row in a table

```DeleteRow(\$R,\$1,\$2)

\$R = Target Table
\$1 = First Row
\$2 = Row Count
```

### EnableColumnEditing

Controls whether a given table column can be edited

```EnableColumnEditing(\$R,\$1)

\$R = Target Column
\$1 = Edit Control
```

### FindColumnLabel

Searches columns in table \$1 for one with a label which matches formatted \$2 and returns the index or 0 if none found

```\$R = FindColumnLabel(\$1,\$2)

\$R = Result
\$1 = Table
\$2 = Find String
```

### FindColumnTitle

Searches columns in table \$1 for one with a title which matches formatted \$2 and returns the index or 0 if none found

```\$R = FindColumnTitle(\$1,\$2)

\$R = Result
\$1 = Table
\$2 = Find String
```

### FindDuplicates

Finds duplicated rows in Table, storing the duplicate row number pairs in the first two columns of table Duplicates. Existing rows in Duplicates are removed. Only values are compared, not text.

```FindDuplicates(\$R,\$1)

\$R = Duplicates
\$1 = Table
```

### GetCellBackgroundColor

Returns ARGB or index value for a cell's background color. Will be null index (255) if not set for the cell

```\$R = GetCellBackgroundColor(\$1)

\$R = Result
\$1 = Table Cell
```

### GetCellTextColor

Returns ARGB or index value for a cell's text color. Will be null index (255) if not set for the cell

```\$R = GetCellTextColor(\$1)

\$R = Result
\$1 = Table Cell
```

### GetColSecondTitle

Sets the target to a label of the second title row for the given column

```GetColumnSecondTitle(\$R,\$1)

\$R = Result
\$1 = Column
```

### GetColumnProperty

Read a property of a table column

```\$R = GetColumnProperty(\$1,\$2)

\$R = Result
\$1 = Table Column
\$2 = Property Label
```

### ImportFromClipboard

Performs import of table data/structure from clipboard as available in the table editor

```\$R = ImportFromClipboard(\$1,\$2)

\$R = Result
\$1 = Target Table
\$2 = Configure
```

### InsertColumn

Insert columns into a table with the option of copying formatting from another column

```InsertColumn(\$R,\$1,\$2,\$3)

\$R = Target Table
\$1 = Insert Pos.
\$2 = Col Count
\$3 = Copy Format
```

### InsertRow

Insert a number of rows at a given row in a table

```InsertRow(\$R,\$1,\$2)

\$R = Target Table
\$1 = Insert Pos.
\$2 = Row Count
```

### MatchMultipleKeys

Searches table from the top for the first instance where the given columns have the given values. Returns row number or 0 if no match. Column 3 may be zero for a 2 column search.

```\$R = MatchMultipleKeys(\$1,\$2,\$3,\$4,\$5,\$6,\$7,\$8)

\$R = Result
\$1 = Table
\$2 = Start Row
\$3 = Column 1
\$4 = Match 1
\$5 = Column 2
\$6 = Match 2
\$7 = Column 3
\$8 = Match 3
```

### MaxIndexIFMatch

Returns first row with maximum Data Column value for rows where Match Column matches Match Key. Returns 0 if no rows match.

```\$R = MaxIndexIFMatch(\$1,\$2,\$3)

\$R = Result
\$1 = Match Column
\$2 = Match Key
\$3 = Data Column
```

### MinIndexIFMatch

Returns first row with minimum Data Column value for rows where Match Column matches Match Key. Returns 0 if no rows match.

```\$R = MinIndexIFMatch(\$1,\$2,\$3)

\$R = Result
\$1 = Match Column
\$2 = Match Key
\$3 = Data Column
```

### OutOfScopeWrite

Enable writing to item table reference \$1 even if it is not in scope

```OutOfScopeWrite(\$1)

\$1 = Item Table Ref
```

### PositionLastRow

Intended for use after a single row has been appended to an already-sorted table, this will efficiently move that last row to the position to maintain the sort. Table must already be sorted by the sort criteria.

```PositionLastRow(\$R,\$1,\$2,\$3,\$4)

\$R = Target
\$1 = Column 1
\$2 = Column 2
\$3 = Column 3
\$4 = Column 4
```

### PurgeDuplicateRows

Removes any identical rows from the given table

```PurgeDuplicateRows(\$R)

\$R = Target
```

### ReverseSearch

Decrement the result attribute from first to last until the condition is true. If the search fails, returns ast_index – 1 or 0 if 'Zero On Fail' is true.

```\$R = ReverseSearch(\$F,\$1,\$2,\$3)

\$R = Result
\$1 = First Index
\$2 = Last Index
\$3 = Zero On Fail
\$F = Condition
```

### Search

Increment the result attribute from first to last until the condition is true. If the search fails, returns 1 + last_index or 0 if 'Zero On Fail' is true.

```\$R = Search(\$F,\$1,\$2,\$3)

\$R = Result
\$1 = First Index
\$2 = Last Index
\$3 = Zero On Fail
\$F = Condition
```

### SetCellBackgroundColor

Sets the background color for the cell.

```SetCellBackgroundColor(\$1,\$2)

\$1 = Table Cell
\$2 = Color Value
```

### SetCellFreeText

Sets the free text (not bound by label text rules) for a table cell

```SetCellFreeText(\$R,\$1)

\$R = Target Cell
\$1 = Source Cell
```

### SetCellTextColor

Sets the text color for the cell

```SetCellTextColor(\$1,\$2)

\$1 = Table Cell
\$2 = Color Value
```

### SetColAlignment

Enables a column's text alignment to be changed

```SetColumnAlignment(\$R,\$1)

\$R = Target Column
\$1 = Align Mode
```

### SetColSecondTitle

Sets the text of the second title row for the given column

```SetColumnSecondTitle(\$R,\$1)

\$R = Target Column
\$1 = Title Text
```

### SetColTitle

Set the title text of a table column

```SetColumnTitle(\$R,\$1)

\$R = Target Column
\$1 = Title Text
```

### SetColTupleName

Sets the name used to internally identify a column

```SetColumnTupleName(\$R,\$1)

\$R = Target Column
\$1 = Tuple Text
```

### SetColumnProperty

Set a property of a table column

```SetColumnProperty(\$1,\$2,\$3)

\$1 = Table Column
\$2 = Property Label
\$3 = Property Value
```

### SetColumnTip

Sets the tool tip of a table column

```SetColumnTip(\$R,\$1)

\$R = Column
\$1 = Tip Text
```

### SetColWidth

Sets the formatting width of a table column

```SetColWidth(\$R,\$1)

\$R = Target Column
\$1 = Column Width
```

### SetTableRowHeight

Sets the height of table rows

```SetTableRowHeight(\$1,\$2)

\$1 = Target Table
\$2 = Row Height
```

### SetTableTitle

Set the title text of the table from the label

```SetTableTitle(\$R,\$1)

\$R = Target Table
\$1 = Title Text
```

### ShiftCol

Shift the columns in a table

```ShiftColumn(\$R,\$1,\$2)

\$R = Result
\$1 = Source
\$2 = Shift <+ ->
```

### ShiftRow

Shift the rows in a table

```ShiftRow(\$R,\$1,\$2)

\$R = Result
\$1 = Source
\$2 = Shift ^+ -v
```

### Sort

Sort table by up to 4 columns. If the column index is -ve, it reverses the sort order for that column.

```Sort(\$R,\$1,\$2,\$3,\$4)

\$R = Target
\$1 = Column 1
\$2 = Column 2
\$3 = Column 3
\$4 = Column 4
```

### SumIFMatch

Sums values in Data Column for rows where Match Column matches Match Key

```\$R = SumIFMatch(\$1,\$2,\$3)

\$R = Result
\$1 = Match Column
\$2 = Match Key
\$3 = Data Column
```

### TableReferenceSet

Returns non zero if the reference resolves to a table

```\$R = TableReferenceSet(\$1)

\$R = Result
\$1 = Item Table Ref
```

### TableSortDialog

Enables the user to set up and perform a sort using the table sort dialog

```TableSortDialog(\$R)

\$R = Target
```

### UpdateColumnRefs

Re-initialises column labels for references to a table

```UpdateColumnRefs(\$1)

\$1 = Table
```

## Table View

### ClearFilter

Clear filter settings for a table view

```ClearFilter(\$1,\$2)

\$1 = Table
\$2 = Panel
```

### CopyAllFromView

Copies the entire contents of a table view. Any current selection is ignored and left intact.

```CopyAllFromView(\$1,\$2,\$3)

\$1 = Table
\$2 = Panel
\$3 = Col Labels
```

### CopyFromView

Copies the current cell or selection from a specified table view just as if CTRL-C was pressed

```CopyFromView(\$1,\$2)

\$1 = Table
\$2 = Panel
```

### DeleteView

Deletes view during run. Data is the table, attribute the view is for. Panel is where the view is located.

```DeleteView(\$1,\$2,\$3,\$4)

\$1 = Data
\$2 = Panel
\$3 = View Type
\$4 = Index
```

### GetColumnFilter

Gets any active column filter for a table view

```\$R = GetColumnFilter(\$1,\$2)

\$R = Text/Label
\$1 = Column
\$2 = Panel
```

### GetFilteredRows

Retrieves the filter mapping of view rows to actual rows into the list table

```GetFilteredRows(\$1,\$2,\$3)

\$1 = Filter List
\$2 = Table
\$3 = Panel
```

### GetTableView

Read columns of a table view into another table

```GetTableView(\$1,\$2,\$3)

\$1 = View Table
\$2 = View Panel
\$3 = Config Table
```

### GetViewProperty

Retrieves a property of a view of a table on a given panel. Index specifies which view and is useful when multiple exist.

```\$R = GetViewProperty(\$1,\$2,\$3,\$4,\$5)

\$R = Result
\$1 = Table
\$2 = Panel
\$3 = Property
\$4 = View Type
\$5 = Index
```

### NearestPoint

Returns the row of the closest point on a Log Driven Display. If Overlay is non zero, only that overlay is checked. Max Distance sets the largest distance that will be considered in the matching. With no match, the function returns 0.

```\$R = NearestPoint(\$1,\$2,\$3,\$4,\$5,\$6)

\$R = Result
\$1 = Table
\$2 = Panel
\$3 = X
\$4 = Y
\$5 = Overlay
\$6 = Max Distance
```

### PasteIntoView

Pastes the system clipboard into a table view starting at the specified Top Left cell. Returns zero on success

```\$R = PasteIntoView(\$1,\$2,\$3,\$4,\$5,\$6,\$7)

\$R = Error Result
\$1 = Table
\$2 = Panel
\$3 = TL Row
\$4 = TL Col
\$5 = Options
```

### ReFilterTableView

Reapply any active filters to the current data in the table

```ReFilterTableView(\$1,\$2)

\$1 = Table
\$2 = Panel
```

### SetCellColor

Set text and background colours for cells, supporting doing entire columns, rows or tables as well. In all cases the per cell colour is set.

```SetCellColor(\$1,\$2,\$3)

\$1 = Cell
\$2 = TextColor
\$3 = BackColor
```

### SetColumnFilter

Sets a column filter text for a table view. The filter needs to be reapplied once all the columns have been set.

```SetColumnFilter(\$R,\$1,\$2)

\$R = Column
\$1 = Text
\$2 = Panel
```

### SetTableView

Set columns that a table view will display

```SetTableView(\$1,\$2,\$3)

\$1 = View Table
\$2 = View Panel
\$3 = Config Table
```

### SetTableViewColScroll

Sets the column scroll of a view for a table on a given panel

```SetTableViewColScroll(\$1,\$2,\$3)

\$1 = Table
\$2 = Panel
\$3 = Value
```

### SetTableViewRowScroll

Sets the row scroll of a view for a table on a given panel

```SetTableViewRowScroll(\$1,\$2,\$3)

\$1 = Table
\$2 = Panel
\$3 = Value
```

### SetViewFilterRows

Sets the rows that a table view on a panel will display. Filter List is a column of row numbers.

```SetViewFilterRows((\$1,\$2,\$3)

\$1 = Filter List
\$2 = Table
\$3 = Panel
```

### SetViewProperty

Sets a property of a view of a table on a given panel. Index specifies which view and is useful when multiple exist.

```SetViewProperty(\$1,\$2,\$3,\$4,\$5,\$6)

\$1 = Table
\$2 = Panel
\$3 = Property
\$4 = Value
\$5 = View Type
\$6 = Index
```

### TableViewColScroll

Reads the column scroll of a view for a table on a given panel

```\$R = TableViewColScroll(\$1,\$2)

\$R = Target
\$1 = Table
\$2 = Panel
```

### TableViewRows

Reads the number of rows in a table view. If a filter is set, this may differ from the number of rows in the table

```\$R = TableViewRows(\$1,\$2)

\$R = Target
\$1 = Table
\$2 = Panel
```

### TableViewRowScroll

Reads the row scroll of a view for a table on a given panel

```\$R = TableViewRowScroll(\$1,\$2)

\$R = Target
\$1 = Table
\$2 = Panel
```

### TableViewVisibleCols

Reads the number of visible columns in a table view

```\$R = TableViewVisibleCols(\$1,\$2)

\$R = Target
\$1 = Table
\$2 = Panel
```

### TableViewVisibleRows

Reads the number of visible rows in a table view

```\$R = TableViewVisibleRows(\$1,\$2)

\$R = Target
\$1 = Table
\$2 = Panel
```

## Time

Enables user to use the advance to time dialog. If Absolute is set, it defaults to an absolute time advance otherwise it defaults to a relative interval. Time is interpreted accordingly depending on Absolute, as an interval or as an absolute time. For an Absolute advance, if its zero, the clock value is the default instead of the model start time.

```AdvanceToTimeDialog(\$1,\$2)

\$1 = Absolute
\$2 = Time
```

### DayOfMonth

Returns the day of the month, starting at 1

```\$R = DayOfMonth(\$1)

\$R = Result
\$1 = Time
```

### DayOfWeek

Returns the day of the week, starting at 1 for Sunday

```\$R = DayOfWeek(\$1)

\$R = Result
\$1 = Time
```

### DaysInDateMonth

Returns how many days in the month of the absolute time

```\$R = DaysInDateMonth(\$1)

\$R = Result
\$1 = Time
```

### FormDate

Computes the absolute time representing midnight on the given date

```\$R = FormDate(\$1,\$2,\$3)

\$R = Result
\$1 = Date
\$2 = Month
\$3 = Year
```

### GetDate

Extracts the date from a date/time

```\$R = GetDate(\$1)

\$R = Result
\$1 = Date/Time
```

### HourOfDay

Returns the hour into the current day of the time, starting at 0

```\$R = HourOfDay(\$1)

\$R = Result
\$1 = Time
```

### HourOfDay+1

Returns the hour into the current day of the time, starting at 1 instead of 0

```\$R = HourOfDay_1(\$1)

\$R = Result
\$1 = Time
```

### IncrementByMonths

Increments the date by one or more months, attempting to keep the same day of month

```IncrementByMonths(\$R,\$1)

\$R = Result
\$1 = # of months
```

### MonthOfYear

Returns the month of the year, starting at 1 for January

```\$R = MonthOfYear(\$1)

\$R = Result
\$1 = Time
```

### TimeOfDay

Returns the number of seconds into the current day of the time

```\$R = TimeOfDay(\$1)

\$R = Result
\$1 = Time
```

### WeekOfYear

Returns the week of the year, starting at 1

```\$R = WeekOfYear(\$1)

\$R = Result
\$1 = Time
```

### YearOfDate

Returns the year of the given calendar time

```\$R = YearOfDate(\$1)

\$R = Result
\$1 = Time
```

## Tuple

### DecodeMultiLabelToTuple

Extracts the fields of a multi-label to item attributes with names matching the label lists in the multi-label

```DecodeMultiLabelToItem(\$R)

\$R = Target
```

### EncodeItemToMultiLabel

Combines item attributes to form a multi-label, for item attributes with names matching the label lists in the multi-label

```EncodeItemToMultiLabel(\$R)

\$R = Target
```

### MatchedCopyRow

Copy rows between tables where the column names match

```MatchedCopyRow(\$R,\$1)

\$R = Result
\$1 = Set To
```

### TupleAppendFromCarried

Append a row to the table and for it, set table columns from a carried item's attributes with the same name

```TupleAppendFromCarried(\$R,\$1)

\$R = Table
\$1 = Carried Index
```

### TupleAppendFromItem

Append a row into the table and for it, set table columns from item attributes with the same name

```TupleAppendFromItem(\$R)

\$R = Table
```

### TupleCarriedToRow

For the specified row, set table columns from a carried item's attributes with the same name

```TupleCarriedToRow(\$R,\$1)

\$R = Row
\$1 = Carried Index
```

### TupleDecrementToRow

For the specified row, decrement cells with the values of item attributes with matching names

```TupleDecrementFromRow(\$R)

\$R = Row
```

### TupleExtractToCarried

For the specified row, set a carried item's attributes from table columns with the same name then delete the row

```TupleExtractToCarried(\$R,\$1)

\$R = Row
\$1 = Carried Index
```

### TupleExtractToItem

For the specified row, set item attributes from table columns with the same name then delete the row

```TupleExtractToItem(\$R)

\$R = Row
```

### TupleIncrementToRow

For the specified row, increment cells with the values of item attributes with matching names

```TupleIncrementToRow(\$R)

\$R = Row
```

### TupleInsertFromCarried

Insert a row into the table and for it, set table columns from a carried item's attributes with the same name

```TupleInsertFromCarried(\$R,\$1)

\$R = Row
\$1 = Carried Index
```

### TupleInsertFromItem

Insert a row into the table and for it, set table columns from item attributes with the same name

```TupleInsertFromItem(\$R)

\$R = Row
```

### TupleItemToRow

For the specified row, set table columns from item attributes with the same name

```TupleItemToRow(\$R)

\$R = Row
```

### TupleRowToCarried

For the specified row, set a carried item's attributes from table columns with the same name

```TupleRowToCarried(\$R,\$1)

\$R = Row
\$1 = Carried Index
```

### TupleRowToItem

For the specified row, set item attributes from table columns with the same name

```TupleRowToItem(\$R)

\$R = Row
```

## UI

```AddListToMenu(\$1,\$2)

\$2 = Item List
```

### BringToFront

If a panel is open in a popup window, bring that popup to the front in the window z-order.

```BringToFront(\$1)

\$1 = Panel
```

### BrowseFile

Browse for a file. Returns non zero if one chosen. FileName sets an initial file, Options can combine:1 to enable a save-style dialog (default is load) and 2 to enable stay in directory (default is to return to working directory). Use s.LastAccessedDataFile and s.LastAccessedDataFilePath to access the file and full path spec of the file selected.

```\$R = BrowseFile(\$1,\$2)

\$R = File Chosen
\$1 = FileName
\$2 = Options
```

```ClearCustomMenubar

```

### Dialog

Show a dialog box for the user to interact with

```\$R = Dialog(\$F)

\$R = Result
\$F = Dialog
```

### DragIcon

Displays an icon and enables user to position it. X and Y are the starting position (center) in panel co-ordinates. If a move is performed, new co-ordinates are written to these values. Icon selects an image which defines the bounding box. Returns non zero if the move was not cancelled. Supports being invoked with mouse down or up. Keys also supported.

```\$R = DragIcon(\$1,\$2,\$3,\$4)

\$R = result
\$1 = X Value
\$2 = Y Value
\$3 = Panel
\$4 = Icon Name
```

Interprets columns in table as depth/name/index and generates a popup menu. Returns index of selected item or 0 if cancelled

```\$R = HandlePopupMenu(\$1)

\$R = Result
\$1 = Table
```

### InitiateFieldEdit

Starts editing attribute/cell views on a panel, as if the user clicked on the first one

```InitiateFieldEdit(\$1)

\$1 = Target Panel
```

### MessageBox

Displays a standard message box with an OK button

```MessageBox(\$1,\$2)

\$1 = Text
\$2 = Title
```

### MessageBoxConfirm

Displays a standard message box with OK (1) / Cancel (0) Buttons

```\$R = MessageBoxConfirm(\$1,\$2)

\$R = Result
\$1 = Text
\$2 = Title
```

### MessageBoxYN

Displays a standard message box with Yes (1) / No (0) Buttons

```\$R = MessageBoxYN(\$1,\$2)

\$R = Result
\$1 = Text
\$2 = Title
```

### MessageBoxYNC

Displays a standard message box with Yes (1) / No (0) / Cancel (-1) buttons

```\$R = MessageBoxYNC(\$1,\$2)

\$R = Result
\$1 = Text
\$2 = Title
```

```SetMenuBar(\$1)
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://wiki.planimate.com/index.php?title=Routine_Operations&oldid=4136", "fetch_time": 1544654242000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2018-51/segments/1544376824119.26/warc/CC-MAIN-20181212203335-20181212224835-00525.warc.gz", "warc_record_offset": 784953446, "warc_record_length": 39487, "token_count": 21248, "char_count": 73445, "score": 3.75, "int_score": 4, "crawl": "CC-MAIN-2018-51", "snapshot_type": "latest", "language": "en", "language_score": 0.7421542406082153, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00000-of-00064.parquet"}