Log In    |    Knowledge Base    |    4D Home
Tech Tip: Saving the text in a 4D Write area to your Text field or variable
Published On: January 3, 2008
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

4D Write areas support saving their contents programmatically as either a picture or a BLOB. Another option that is not offered with a single command (like the WR Area to blob command) is saving the text of a 4D Write area into a text field or variable. Here is a quick code snippet that can be run to save a 4D Write area's text:

$countChar:=WR Count($areaRef;0)
$textVar:=WR Get text($area;0;$countChar)

It is important to note in this case that the formatting of the 4D Write area is not saved in the text variable. Additionally, there is a 32,000 character limit to Text variables and fields if your database is running in non-Unicode mode instead of Unicode mode in 4D v11 SQL. In Unicode mode the limit is 2GB of text.