A NEW TODAY IS DAWNING!

TB0021 - Global Search and Replace

Number: TB0021

Availability: As of BuildPro 8.00, all users.


NOTE: When using Search and Replace always make sure you backup your application source prior to running the replace. It is not possible to "undo" a replace instruction.


Introduction

A new feature in the BuildPro Vision developer

The introduction of the new XML and TEXT commands provide a good example for using the new Replace tools in the BuildPro Development Environment.


Problem

An alpha implementation of the TEXT command was originally introduced as the XML command in January 2009. Subsequently in 8.00 a true XML command was introduced and developers will be required to change references to XML to TEXT.

There are one-to-one relationships between the old and new commands, so a simple global search and replace does the trick.

Example:

In 7.00 the command to insert data into a text buffer was:

XML *RAW "buffer" "data" "data2" "data3"

In 8.00 this command was changed to:

TEXT *STRING "buffer" "data" "data2" "data3"

Using the BuildPro developer global search and replace (Tools / Replace...) all commands can be replaced from one screen. The following screen shows a typical replace using the above command example:
 

Replace screen


The "old" XML Command

The following table lists the complete search and replace text when converting the old XML command in TEXT.

Note. The *STRING option is usually preferable to *RAW when creating flat text files. In *STRING all dataref arguments are converted to character format independent of their native storage format in BuildPro. TEXT *RAW does not automatically add new-line characters.

 

Old Command New Command
XML *RAW TEXT *STRING
XML *BUFFER TEXT *BUFFER
XML *RELEASE TEXT *RELEASE
XML *OPEN TEXT *OPEN
XML *WRITE TEXT *WRITE
XML *CLOSE TEXT *CLOSE

Generate

Clicking the generate check box option will perform a generate on logic following each replace. For larger applications it is better to perform the search and replace first and then generate all logic from the generate pulldown menu.


Multiple Search and Replace

The global search and replace feature uses functionality similar to the REPLACE command and therefore can perform multiple search and replace operations in one instruction. For correct syntax, see the REPLACE command in the online documentation.