# System.Evaluate(var Any, Text [, Integer]) Method
> Version: _Available or changed with runtime version 1.0._
Evaluates a string representation of a value into its typical representation. The result is assigned to a variable.
## Syntax
```al
[Ok := ]  System.Evaluate(var Variable: Any, String: Text [, Number: Integer])
```
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
Variable
Type: ../any/any-data-type
The value of the string is assigned to the variable.
String
Type: ../text/text-data-type
A string that contains a value of any simple AL data type.
*[Optional] Number*
Type: ../integer/integer-data-type
This optional value can be used when exporting data with an XmlPort. The only valid values are 9 and 10. 9 indicates that the data must be converted from XML format to C/SIDE format. 10 indicates that the data must be converted from bookmark.
## Return Value
*[Optional] Ok*
Type: ../boolean/boolean-data-type
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.
## Example
This example shows how to use the Evaluate method when it is called with four different types of variables.
```al
var
    VarInteger: Integer;
    VarDate: Date;
    VarYesNo: Boolean;
    VarDuration: Duration;
    Value: Text;
    Ok1: Boolean;
    Ok2: Boolean;
    Ok3: Boolean;
    Ok4: Boolean;
    Text000: Label 'VarInteger = \#1\#\#\#\#\#\#. The return code is: %2.\\';
    Text001: Label 'VarDate = \#3\#\#\#\#\#\#. The return code is: %4.\\';
    Text002: Label 'VarYesNo = \#5\#\#\#\#\#\#. The return code is: %6.\\';
    Text003: Label 'VarDuration = %7. The return code is: %8.';
begin
    Value := '010196';
    Ok1 := Evaluate(VarInteger, Value);
    Ok2 := Evaluate(VarDate, Value);
    Ok3 := Evaluate(VarYesNo, Value);
    Value := '2days 4hours 3.7 seconds 17 milliseconds';
    Ok4 := Evaluate(VarDuration, Value);
    Message(Text000 + Text001 + Text002 + Text003, VarInteger, Ok1, VarDate, Ok2, VarYesNo, Ok3, VarDuration, Ok4);
end;
```
The message window displays the following:
VarInteger = 010196. The return code is: Yes.
VarDate = 01/01/96. The return code is: Yes.
VarYesNo = No. The return code is: No.
VarDuration = 2 days 4 hours 3 seconds 717 milliseconds. The return code is: Yes.
This example shows that although Value \('010196'\) can be interpreted as both an integer and a date expression, it can't be interpreted as a Boolean expression. This causes an error, shown in the return code Ok3 \(=False\).
This example also shows that when you evaluate a string as a duration data type, you can use certain words in the string to describe the duration. The following words or abbreviations are supported:
 day, days, d
 hour, hours, h
 minute, minutes, min, m
 second, seconds, sec, s
 millisecond, milliseconds, milli, millis
You can include decimal values in the string that you evaluate as a duration, except for milliseconds, which must be a whole number.
## Related information
system-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-evaluate-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/system/system-evaluate-method/
