{"title":"BigText.AddText(BigText [, Integer]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/bigtext/bigtext-addtext-bigtext-integer-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/bigtext/bigtext-addtext-bigtext-integer-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/bigtext/bigtext-addtext-bigtext-integer-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":"Adds a text string to a BigText variable.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":102,"chars":76},{"level":2,"title":"Parameters","slug":"parameters","at":178,"chars":706},{"level":2,"title":"Remarks","slug":"remarks","at":884,"chars":973},{"level":2,"title":"Example 1","slug":"example-1","at":1857,"chars":580},{"level":2,"title":"Example 2","slug":"example-2","at":2437,"chars":312},{"level":2,"title":"Example 3","slug":"example-3","at":2749,"chars":252},{"level":2,"title":"Example 4","slug":"example-4","at":3001,"chars":207},{"level":2,"title":"Related information","slug":"related-information","at":3208,"chars":135}],"text":"> Version: _Available or changed with runtime version 1.0._\nAdds a text string to a BigText variable.\n## Syntax\n```al\n BigText.AddText(String: BigText [, Position: Integer])\n```\n## Parameters\nBigText\nType: bigtext-data-type\nAn instance of the bigtext-data-type data type.\nString\nType: bigtext-data-type\nThe string that will be added to the BigText variable. If this parameter is empty, then the BigText variable is not modified.\n*[Optional] Position*\nType: ../integer/integer-data-type\nThis is an optional parameter that defines the position in the BigText variable where the string is inserted. If this parameter is omitted, then the string is added at the end of the BigText variable. If this parameter is less than one, then a run-time error occurs. If this parameter is greater than the length of the BigText variable, then the string is added at the end of the BigText variable.\n## Remarks\nVariable can be inserted anywhere in BigText or added at the end of the BigText.\nThe first character in a BigText variable is position 1.\nTo delete the content in a BigText variable, use the ../system/system-clear-joker-method. The following code shows the syntax for the method: `Clear(BigText)`\n> NOTE\n> If you use AddText to add multiple BigText strings to what is presented as a single string, you can experience performance problems. The same applies to other repetitive uses of AddText. This is due to the implementation of the BigText data type, which relies on a String object that is immutable. You can avoid this issue by refactoring the code to reduce the number of additions or deletions. Alternatively, you can change your implementation to use the https://learn.microsoft.com/dotnet/api/system.text.stringbuilder class instead. See Immutability and the StringBuilder Class<https://learn.microsoft.com/dotnet/api/system.string> in the MSDN Library.\n## Example 1\nThe following examples show how to use the AddText method. The specified text is inserted into the BigText string at the specified position. In these examples, the initial content of the BigText variable is ABCDEFG. These examples require that you create the following variable.\n```al\nvar\n    MyBigText: BigText;\n```\nThe following example inserts the string 'ZZZ' after the character B in the MyBigText variable because 3 is specified for Position.\n```al\n// Example 1\nMyBigText.AddTEXT('ABCDEFG');\nMyBigText.AddTEXT('ZZZ', 3); // Returns the subtext ABZZZCDEFG.\n\n```\n## Example 2\nThe following example appends the string 'ZZZ' at the end of the MyBigText variable because the number specified for Position is greater than the length of the MyBigText variable.\n```al\n// Example 2\nMyBigText.AddText('ABCDEFG');\nMyBigText.AddText('ZZZ', 15); // Returns the subtext ABCDEFGZZZ.\n\n```\n## Example 3\nIn the following example, the content of the MyBigText variable is unchanged because the specified variable is an empty string.\n```al\n// Example 3\nMyBigText.AddText('ABCDEFG');\nMyBigText.AddText('', 1); // Returns the subtext ABCDEFG.\n```\n## Example 4\nIn the following example, the method returns an error because 0 is specified for Position.\n```al\n// Example 4\nMyBigText.AddText('ABCDEFG');\nMyBigText.AddText('ZZZ', 0); // Returns an error.\n```\n## Related information\nbigtext-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}