XCM Quick Reference Cards
XCM Quick Reference Cards
Maths Functions
Abs(Number) – Absolute Value of Number
Atn(Number) – Returns the arc tangent in radians of a number
Cos(Angle in Radians) – Returns the cosine of an angle which is in radians
Exp(Number) – Returns the base of the natural log raised to a power (e^num)
Fix(Number) – Returns the integer portion of a number
Int(Number) – Returns the integer portion of a number
Log(Number) – Returns the natural log of a number greater than zero
Rnd() – Returns a random number between zero and one
Sin(Angle in Radians) – Returns the sine of an angle which is in radians
Sgn(Number) – Returns 1 for a positive number, 0 for zero and –1 for a negative number
Sqr(Number) – Returns the square root of a number
Tan(Angle in Radians) – Returns the tangent of an angle which is in radians
Arrays
Erase Array Name – Re-initialises the elements of a fixed array
LBound(Array[, Dimension]) – Returns the smallest available subscript for the dimension of the array
Option Base Number – Declares the default lower bound for array subscripts (default is 0, only other option is 1)
ReDim ArrayName(Number of Subscripts) – Used to re-size an array that has already been declared using Dim with empty parenthesis
UBound(Array[, Dimension]) – Returns the largest available subscript for the dimension of the array
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. -1-
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 XCM QUICK REFERENCE - STANDARD
Control Structures
Do While condition…..[Exit Do]…..Loop – Repeats a group of statements while the condition is true
Do Until condition…..[Exit Do]…..Loop – Repeats a group of statements until a condition is true
Do…..[Exit Do]…..Loop While condition – Repeats a group of statements while the condition is true
Do…..[Exit Do]…..Loop Until condition – Repeats a group of statements until a condition is true
End Function|If|Sub – Ends a program or a block of statements such as a function, subroutine or if test
Exit Do|For|Function|Sub – Exits a loop or procedure
For Each Element In Group…..[Exit For]…..Next Element – Repeats a group of statements for each element in an array of a collection
For Counter = Expression1 to Expression2 [Step Increment]…..[Exit For]…..Next Counter – Repeats the execution of a block of statements a
specified number of times
GoTo Label – Branches unconditionally and without return to a specified label in a procedure
If Condition Then….. – Allows conditional statements to be executed in the code
If Condition Then…..Else…..End If – Allows conditional statements to be executed in the code
If Condition Then…..ElseIf Condition Then…..End If – Allows conditional statements to be executed in the code
Select Case TestVariable…..Case Value1…..Case Value2…..Case Else…..End Select – Executes one of the Case statement blocks based on
the value of the test variable
Stop – Ends execution of the program
While Condition…..Statements…..Wend – Executes the statements while the condition is true
With Object…..Statements…..End With – Allows you to perform a series of commands on a particular object, without again referring to the
name of that object
Strings
Asc(String) – Returns ASCII code for the first character in the string
Chr(ASCII Number) – Returns the one character string for the ASCII number
InStr(Number Begin, String 1, String 2) – Returns the character position of the first occurrence of String 2 within String 1
LCase(String) – Returns a string in which all letters of the string have been converted to lower case
Left(String, Number) – Returns the left most number of characters from a string
Len(String) – Returns the number of characters in a string
LTrim(String) – Returns the string with the leading spaces removed
Mid(String, Begin, Length) – Returns a sub-string within the string, which starts at character number Begin and is Length characters long
Right(String, Number) – Returns the right most number of characters from a string
RTrim(String) – Returns the string with the trailing spaces removed
Str(Expression) – Converts any valid expression to a string
StrComp(String1,String2) – Returns zero if the strings are the same and plus or minus one if the strings are different (depending on the
characters in the strings)
String(Number, Character String or Code) – Returns a string made up of a single character repeated a number of times
Trim(String) – Returns the string with the leading and trailing spaces removed
UCase(String) – Returns a string in which all letters of the string have been converted to upper case
Val(String) – Returns the numeric value of a string of numeric characters
OLE Commands
AppActivate “Text in Title Bar of Application Window” – Activates an Application
CreateObject(class) – Creates an OLE automation object
GetObject(Filename[, Class]) – Get an object from a file
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. -2-
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 XCM QUICK REFERENCE - STANDARD
Windows
Beep – Sounds a tone through the computer’s speakers
InputBox(Prompt[, Title] [, Default] [, x Position, y Position]) – Displays an input box (in position xy) containing the prompt, with the default value
for the string that is returned
MsgBox(Message[, Type] [, Title]) – Displays a message in a dialog box and waits for the user to select a button defined by Type
Print [Expression1, Expression2,……] – Prints a string to the compiler messages window
SendKeys(Keys[, Wait]) – Sends one or more keystrokes to the active window as if they had been entered at the keyboard
Dialog Boxes
CheckBox Starting x Position, Starting y Position, Width, Height - Used in a Dialog Box for selecting one or more in a series of choices
Dialog(Dialog Record) – Used to display the dialog box specified by Dialog Record which is the name of the dialog and must be defined in a
preceding Dim statement
DlgEnable “Control Name”, Value – This statement is used to enable (Value=1) or disable (Value=0) a particular control on a dialog box
DlgText “Control Name”, Text String – This statement is used to set or change the text of a dialog control
DlgVisible “Control Name”, Value – This statement is used to hide (Value=0) or make visible (Value=1) a particular control on a dialog box
OKButton Starting x Position, Starting y Position, Width, Height – Used in dialog boxes to add an OK Button for selecting options and closing
the dialog box
Text Starting x Position, Starting y Position, Width, Height, Label - Used in dialog boxes to create a text field for titles and labels
TextBox Starting x Position, Starting y Position, Width, Height, Default String - Used in dialog boxes to create a text box for typing in numbers
and text
Directories
ChDir Pathname – Changes the default directory
ChDrive Drivename – Changes the drive
CurDir(Drive) – Returns the current path for the specified drive
MkDir Path – Creates a directory with the given path (maximum characters is 128)
Name OldName As NewName – Changes the name of a directory or file
RmDir PathName – Removes an existing directory with the path name
Miscellaneous
Choose(Number, Choice1[, Choice2] [, Choice3] [,…]) – Returns the choice corresponding to the number
On Error [GoTo Label|Resume Next|GoTo 0] – Defines how to handle an error
Rem Remark – Used to include explanatory remarks in a program
Shell(ProgramName[, Style]) – Runs an executable program in a window defined by the style
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. -3-
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 XCM QUICK REFERENCE
REFERENCE - STANDARD
You can also use scripts to define a range constraint in the ranges dialog box. Press the Edit button, in the constraint view, and select a
filename in the Script field of the dialog box.The file specified must contain the following function: (This is the simplest example):
Function RANGE_CONSTRAINT As Integer\n"
RANGE_CONSTRAINT = (Value)
End Function
XPAC 2006
2006 XCM QUICK REFERENCE - SCHEDULING
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. -4-
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 XCM QUICK REFERENCE - SCHEDULING
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. -5-
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 200
2006 XCM QUICK REFERENCE - SCHEDULING
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. -6-
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 - REPORT WRITE
WRITERR
Filters
M(Data Field Number or Full Row Code) – Used for filtering records according to the value of the main database data field
Condition1 And Condition2 – Both the conditional statement before and after the Or must be true for a scheduling step to be passed by the filter
Condition1 Or Condition2 – Either the conditional statement before or after the Or must be true for a scheduling step to be passed by the filter
Not(Condition) – If the conditional statement is true then the step will not be passed by the filter
Activity(Activity Number) – Used to over-ride the productive activity associated with the main database data field in the result
Resource(“Resource Name”) – Used to only pass steps that were scheduled by the specified resource
Pil(Level Number, Pil Number) – Used to only pass record that have the specified position in level number at the specified database level
GetApil(Level Number) – Used for filtering records according to the value of the position in level number at the specified level
StepType(1 is Productive 2 is Non-Productive Non-Operating 3 is Non-Productive Operating 4 is Non-Productive Extended Operations 5 is Non-
Rostered Non-Operating) – Used for filtering records according to their step type
GetClass(Data Field Number or Full Row Code) – Used for filtering records according to the value of the specified classified field
Destination(“Stockpile name”) – Returns true if the current output path elements’ destination is the same as the supplied stockpile name.
GetDestApil(Level Number) - Used for filtering records by destination according to the value of the position in level number at the specified level.
StockpileInventory () – Returns true if the current output path elements’ source or destination record is the specified stockpile or is a child of
the specified stockpile.
StartedTask() – Returns true for all started productive steps in a given period, and causes the result field to report a non-prorated value. (*)
CompletedTask() – Returns true for all completed productive steps in a given period, and causes the result field to report a non- prorated value.
(*)(**)
LastStartedTask() – Returns true for the last started productive step in a given period, and causes the result field to report a non-prorated
value. (*)
LastCompletedTask() – Returns true for the last completed productive step in a given period, and causes the result field to report a non-
prorated value. (*)(**)
FirstStartedTask() – Returns true for the first started productive step in a given period, and causes the result field to report a non-prorated
value. (*)
FirstCompletedTask() – Returns true for the first completed productive step in a given period, and causes the result field to report a non-
prorated value. (*)(**)
FirstTask() – Returns true for the first productive step in a given period, and causes the result field to report a non-prorated value. (*)
LastTask() – Returns true for the last productive step in a given period, and causes the result field to report a non-prorated value. (*)
TaskPercent() – Returns the percent of the database record taken in the current scheduling output step (values between 0 and 100)
(*) These filters can not be used with each other or multiple times within a single filter. The result is not defined in those circumstances.
(**) If reporting tasks based on a timescale, do not use a timescale with a resolution smaller than that of the calendar used to run the schedule
with this XCM. For example, if a schedule was run using a monthly calendar, do not use a timescale created based on weekly intervals. If you
do, these filters will pass for all the periods in which the completing task spans.
You can also use scripts as a filter – In the filter section of the report type the name of your script, prefaced with an exclamation mark (!)
The file specified must contain the following function. (This is the simplest example):
Function ReportFilter as Boolean
ReportFilter = (Condition)
End Function
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. -7-
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 - REPORT WRITER
Results
SafeDivide(Numerator Value, Denominator Value) – Returns a zero value if the denominator is zero
M(Data Field Number or Full Row Code) – Returns the accumulated main database data field for all steps passed by the filter
C(Data Field Number or Full Row Code) – Returns the calendar database data field value
REP(Line Number) – Returns the accumulated value from the specified line number in the current report writer
MinStep(Data Field Number or Full Row Code) – Returns the minimum amount of the specified main database field taken by a scheduling step
for all steps within a reporting period (excluding 0 quantities)
MinDB(Data Field Number or Full Row Code) – Returns the minimum amount of the specified main database field for all steps within a reporting
period (excluding 0 quantities)
MinOrigStep(Data Field Number or Full Row Code) – Returns the minimum amount of the specified main database field taken by a scheduling
step for all steps within a reporting period (excluding 0 quantities), using the original database value
MinOrigDB(Data Field Number or Full Row Code) – Returns the minimum amount of the specified main database field for all steps within a
reporting period (excluding 0 quantities) , using the original database value
MaxStep(Data Field Number or Full Row Code) – Returns the maximum amount of the specified main database field taken by a scheduling step
for all steps within a reporting period (excluding 0 quantities)
MaxDB(Data Field Number or Full Row Code) – Returns the maximum amount of the specified main database field for all steps within a
reporting period (excluding 0 quantities)
MaxOrigStep(Data Field Number or Full Row Code) – Returns the maximum amount of the specified main database field taken by a scheduling
step for all steps within a reporting period (excluding 0 quantities), using the original database value
MaxOrigDB(Data Field Number or Full Row Code) – Returns the maximum amount of the specified main database field for all steps within a
reporting period (excluding 0 quantities) , using the original database value
GetValue(Field Number, Period Number) – Returns a value from a field in the current report writer, for a previous period
CalendarHrs() – Returns the accumulated calendar hours for all steps passed by the filter
OperatingHrs() – Returns the accumulated productive and non-productive operating hours for all steps passed by the filter
WorkHrs() – Returns the accumulated productive operating hours for all steps passed by the filter
Released(Data Field Number or Full Row Code) – Returns the accumulated released value for the specified main database data field, for all
steps passed by the filter
OpeningInv(Data Field Number or Full Row Code) – Returns the accumulated inventory at the start of the time period, for the specified main
database data field, for all steps passed by the filter
ClosingInv(Data Field Number or Full Row Code) – Returns the accumulated inventory at the end of the time period, for the specified main
database data field, for all steps passed by the filter
PeriodStart() – Returns the period start date
PeriodEnd() - Returns the period end date
RosterHrsResource(Resource Name) - Returns the number of rostered hours performed within the current reporting period for the specified
resource.
RosterHrs(Roster Name, Roster Exception Name) - Returns the number of rostered hours performed within the current reporting period for the
specified resource.
OriginalValue(Data Field Number or Full Row Code, Level 0 Pil[, Level 1 Pil] [, Level 2 Pil] [, Level 3 Pil] [, Level 4 Pil] [, Level 5 Pil] [, Level 6 Pil] [,
Level 7 Pil] [, Level 8 Pil] [, Level 9 Pil] [, Level 10 Pil] ) - Returns the value for a specified data field at the beginning of the schedule based on the
position in level number at each database level.
OpeningInvSP(Data Field Number or Full Row Code) - Returns the accumulated inventory at the start of the time period, for the specified
stockpile database data field, for all steps passed by the filter.
ClosingInvSP(Data Field Number or Full Row Code) - Returns the accumulated inventory at the end of the time period, for the specified
stockpile database data field, for all steps passed by the filter.
OpeningDumpCapacity(Data Field Number or Full Row Code ) - Returns the remaining capacity at the start of the time period, for the specified
dump database capacity data field, for all steps passed by the filter.
ClosingDumpCapacity(Data Field Number or Full Row Code) - Returns the remaining capacity at the end of the time period, for the specified
dump database capacity data field, for all steps passed by the filter.
You can also use scripts as a report result – In the result section of the report, type the name of your script, prefaced with an exclamation
mark(!)
The file specified must contain the following function: (This is the simplest example):
Function ReportResult as Double
ReportResult = (Value)
End Function
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. -8-
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 XCM QUICK REFERENCE - DATABASE
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. -9-
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 XCM QUICK REFERENCE - DATABASE
Parameters Database
GetParam(Data Field Number or Full Row Code, Record Number) – Reads a value from the specified record number in the parameters database
GetParamFromPil(Data Field Number or Full Row Code, Level 1 Pil[, Level 2 Pil] … [, Level 10 Pil]) – Reads a value from the record specified by
the position in level numbers in the parameters database
s SetParam (Data Field Number or Full Row Code, Parameter Value, Record Number) – Assigns a value to the specified record in the
parameters database
s SetParamFromPil(Data Field Number or Full Row Code, Parameter Value, Level 1 Pil[, Level 2 Pil] … [, Level 10 Pil]) – Assigns a value to
the specified record in the parameters database
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. - 10 -
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 XCM QUICK REFERENCE - DATABASE
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. - 11 -
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297
XPAC 2006
2006 XCM QUICK REFERENCE - DATABASE
Maths Functions
DegToRad(Degrees) - Converts an angle in degrees to radians
GetMax(First Value, Second Value) – Returns the maximum of two values
GetMin(First Value, Second Value) – Returns the minimum of two values
IIf(Condition, Return Value for True, Return Value for False) - Returns one of two values depending on whether the condition is true or false
RadToDeg(Radians) - Converts an angle in radians to degrees
SafeDivide(Numerator Value, Denominator Value) – Returns zero if the denominator is zero
Colour Functions
MakeRGB (Red Value 0-255, Green Value 0-255, Blue Value 0-255) – Returns a long value representing the bit pattern set for the desired colour
Record Pointers
CURRENT The current active record
CURRENTDESTINATION In User Processing and Objectives, the current destination record (if applicable)
HOME The original record the script started with
UP The parent record
DOWNFIRST The first child record
DOWNLAST The last child record
PRVSIB The previous sibling under the same parent
NXTSIB The next sibling under the same parent
PRV The previous sibling regardless of parents
NXT The next sibling regardless of parents
Level Numbers
LEVEL1,…LEVEL10 The specified level number
THISLEVEL The level number of the current record
THISAPIL The position in level of the current record
Database Names
MAIN The Main database in the project
PARAMETERS The Parameters database in the project
“Calendar Name” The Calendar database name in quotes
“Results Name” The Results database name in quotes
Record Names
RECORDNAME The name of the record at that level
PATHNAME The full path name of the record
FULLNAME The record number and record path name
ByRef gives other subroutines and functions the permission to make changes to variables that are passed in as parameters. - 12 -
s in the left margin indicates a Subroutine. They do not return a value.
Runge Limited Email: support@runge.com.au Phone: +61 7 3100 7200
May, 2006 Fax: +61 7 3100 7297