VW Scripting Reference
VW Scripting is the built-in expression and scripting language used throughout the DGS platform. It supports both single-line expressions and multi-line script blocks.
Contents
| File | Description |
|---|---|
| Language Reference | Syntax, operators, built-in constants |
| Aggregate-Functions.md | AVG, COUNT, MAX, MIN, SUM, STDEV, ... |
| Date-Functions.md | CDate, Date, DateAdd, DateDiff, DatePart, ... |
| String-Functions.md | Len, Left, Right, Mid, Replace, Split, ... |
| Math-Functions.md | ABS, Round, Sin, Cos, Pow, Sqrt, ... |
| File-Functions.md | FileExists, GetFile, WriteFile, GetFileList, ... |
| Database-Functions.md | ExecuteScalar, GetTable |
| DataTable-Functions.md | GetRowColumn, SetRowColumn |
| Drawing-Functions.md | RGB, ColorToInt, ColorToString |
| Stack-Functions.md | CreateStack, Push, Pop, Peek |
| StringBuilder-Functions.md | GetStringBuilder, SBAppend, SBToString, ... |
| Web-Functions.md | Get, Post, Totp |
| Programming-Functions.md | CInt, CDbl, CStr, IIF, IsNull, IsNumeric, Random |
| UI-Functions.md | MsgBox, InputBox, Start, GetTotalMemory |
| Debugger-Functions.md | Debug, SetTrace, GetFunctionList |
| User-Defined-Functions.md | Writing custom functions |
Language Reference
Comments
' This is a comment — everything after the apostrophe is ignored
x = 1 + 2 ' inline comment
Literals
| Type | Example |
|---|---|
| String | "Hello World" |
| String with embedded quotes | "She said ""hello""" |
| Integer / Double | 42, 3.14 |
| Hexadecimal integer | 0xFF, 0x1A2B |
| Boolean | True, False |
| Null (database null) | null |
| Nothing (no value) | nothing |
Variables
Declare a variable with Dim:
Dim x
Dim y As Integer
Dim name As String
Assign a value:
x = 42
name = "Alice"
Variables are loosely typed. The As Type hint in Dim is accepted but not strictly enforced.
Operators
Arithmetic
| Operator | Description | Example |
|---|---|---|
+ |
Addition (numbers) or concatenation (strings) | 3 + 4, "A" + "B" |
- |
Subtraction | 10 - 3 |
* |
Multiplication | 5 * 6 |
/ |
Division | 10 / 3 |
\ |
Integer division (truncates) | 10 \ 3 → 3 |
% or mod |
Modulus (remainder) | 10 % 3 → 1 |
^ |
Exponentiation | 2 ^ 8 → 256 |
String
| Operator | Description | Example |
|---|---|---|
& |
String concatenation (always) | "Hello" & " " & "World" |
Bitwise / Shift
| Operator | Description |
|---|---|
<< |
Left bit shift |
>> |
Right bit shift |
Comparison — return True or False
| Operator | Description |
|---|---|
= |
Equal |
<> |
Not equal |
< |
Less than |
> |
Greater than |
<= |
Less than or equal |
>= |
Greater than or equal |
Comparisons work with numbers, dates, and strings. When one operand is null the result is False (except <> which returns True, and = / <= / >= between two nulls which return True).
Logical
| Operator | Aliases | Description |
|---|---|---|
and |
&& |
Logical AND |
or |
\|\| |
Logical OR |
xor |
Logical XOR | |
not |
! |
Logical NOT (prefix) |
Operator Precedence (highest to lowest)
!/not(unary)^*,/,\,%,mod+,-,&<<,>>=,<>,<,>,<=,>=and,or,xor,&&,||
Use parentheses ( ) to override precedence.
Line Continuation
Use _ at the very end of a line to continue the expression on the next line:
result = a + b _
+ c + d
Multiple Statements per Line
Separate statements with ::
x = 1 : y = 2 : z = 3
Conditional Statements
If condition Then
' ...
End If
If condition Then
' ...
Else
' ...
End If
If condition Then
' ...
ElseIf condition2 Then
' ...
Else
' ...
End If
Single-line form:
If x > 0 Then y = 1
If x > 0 Then y = 1 Else y = -1
For Loops
For i = 1 To 10
' ...
Next
For i = 10 To 1 Step -1
' ...
Next
Exit a loop early with Exit For.
Built-in Constants
Special values
| Constant | Value |
|---|---|
PI |
3.14159265358979... |
now or now() |
Current date and time |
vbCrLf |
Carriage return + line feed (\r\n) |
vbCr |
Carriage return (\r) |
vbLf |
Line feed (\n) |
null |
Database null (DBNull) |
nothing |
No value (Nothing) |
Color constants
vbBlack, vbRed, vbGreen, vbYellow, vbBlue, vbMagenta, vbCyan, vbWhite
MsgBox style constants
vbOkOnly, vbOkCancel, vbYesNo, vbYesNoCancel, vbAbortRetryIgnore, vbCritical, vbExclamation, vbInformation, vbQuestion, vbRetryCancel, vbMsgBoxHelp
MsgBox result constants
vbOk, vbCancel, vbYes, vbNo, vbAbort, vbRetry, vbIgnore
Data Context Variables
When a script runs in a data context (e.g. inside a report or expression that iterates over a table), these built-in variables are available:
| Variable | Description |
|---|---|
RowNum |
Zero-based index of the current row |
RowCount |
Total number of rows in the current data view |
| ColumnName | Value of the named column in the current row |
Return Values
Use Return to exit a script block and optionally return a value:
Return ' exit with no value
Return x + 1 ' exit and return a computed value