---
url: /flow/guide/scripting-reference/functions/variant/vartowidestrdef.md
---

# VarToWideStrDef

## Declaration

`Function VarToWideStrDef( const V : Variant; const ADefault : WideString) : WideString`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
  Value := VarToWideStrDef(Field.Value, 'abc');
end;
```

## Description

Converts a Variant type variable or field to a widestring. If the Variant is null then the default value will be returned.

This is more commonly used with Variant type variables rather than fields. When accessing fields you can achieve the same thing by using the [Field.AsString](/flow/guide/scripting-reference/classes/field/field.asstring) property, however it is necessary to use with Fields if you want a default value.
