{"title":"System.Evaluate(var Any, Text [, Integer]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/system/system-evaluate-method/","by":"JOP-AL","license":"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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-evaluate-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Evaluates a string representation of a value into its typical representation.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"System.Evaluate(var Any, Text [, Integer]) Method","slug":"systemevaluatevar-any-text-integer-method","at":0,"chars":3176},{"level":2,"title":"Syntax","slug":"syntax","at":228,"chars":174},{"level":2,"title":"Parameters","slug":"parameters","at":402,"chars":496},{"level":2,"title":"Return Value","slug":"return-value","at":898,"chars":238},{"level":2,"title":"Example","slug":"example","at":1136,"chars":1906},{"level":2,"title":"Related information","slug":"related-information","at":3042,"chars":134}],"text":"# System.Evaluate(var Any, Text [, Integer]) Method\n> Version: _Available or changed with runtime version 1.0._\nEvaluates a string representation of a value into its typical representation. The result is assigned to a variable.\n## Syntax\n```al\n[Ok := ]  System.Evaluate(var Variable: Any, String: Text [, Number: Integer])\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nVariable\nType: ../any/any-data-type\nThe value of the string is assigned to the variable.\nString\nType: ../text/text-data-type\nA string that contains a value of any simple AL data type.\n*[Optional] Number*\nType: ../integer/integer-data-type\nThis 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.\n## Return Value\n*[Optional] Ok*\nType: ../boolean/boolean-data-type\ntrue 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.\n## Example\nThis example shows how to use the Evaluate method when it is called with four different types of variables.\n```al\nvar\n    VarInteger: Integer;\n    VarDate: Date;\n    VarYesNo: Boolean;\n    VarDuration: Duration;\n    Value: Text;\n    Ok1: Boolean;\n    Ok2: Boolean;\n    Ok3: Boolean;\n    Ok4: Boolean;\n    Text000: Label 'VarInteger = \\#1\\#\\#\\#\\#\\#\\#. The return code is: %2.\\\\';\n    Text001: Label 'VarDate = \\#3\\#\\#\\#\\#\\#\\#. The return code is: %4.\\\\';\n    Text002: Label 'VarYesNo = \\#5\\#\\#\\#\\#\\#\\#. The return code is: %6.\\\\';\n    Text003: Label 'VarDuration = %7. The return code is: %8.';\nbegin\n    Value := '010196';\n    Ok1 := Evaluate(VarInteger, Value);\n    Ok2 := Evaluate(VarDate, Value);\n    Ok3 := Evaluate(VarYesNo, Value);\n    Value := '2days 4hours 3.7 seconds 17 milliseconds';\n    Ok4 := Evaluate(VarDuration, Value);\n    Message(Text000 + Text001 + Text002 + Text003, VarInteger, Ok1, VarDate, Ok2, VarYesNo, Ok3, VarDuration, Ok4);\nend;\n```\nThe message window displays the following:\nVarInteger = 010196. The return code is: Yes.\nVarDate = 01/01/96. The return code is: Yes.\nVarYesNo = No. The return code is: No.\nVarDuration = 2 days 4 hours 3 seconds 717 milliseconds. The return code is: Yes.\nThis 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\\).\nThis 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:\n day, days, d\n hour, hours, h\n minute, minutes, min, m\n second, seconds, sec, s\n millisecond, milliseconds, milli, millis\nYou can include decimal values in the string that you evaluate as a duration, except for milliseconds, which must be a whole number.\n## Related information\nsystem-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}