![]() www.fireflysoftware.com |
Selective Updates Using an Isolation Block |
|
|
|
|
:In this example I'll show how to use an isolation block to selectively update text. Suppose you have the following "product testing" report that contains three columns of test data grouped by test:
If you wanted to reorder the columns so that the "A" column of data came first, followed by the other two columns of data, you might try using the ReorderColumns filter, but as you might expect, this will alter the other text in the report (which could be significant). How can you reorder just the columns of test data without affecting the other text in the report? The key is to use an isolation block to isolate the lines that you wish to modify. To do this though, you must first group the lines together. This is done here by using the GroupLines filter:
Here, it is used to group all lines containing "Wgt" in column position 4 to 6 together and then to group all lines containing "." in column 5 together. The lines are grouped at the end of the text. Before grouping the lines, a line number is first inserted at the head of each line so that we can later return the text to its original order. The result of executing the above 3 filters is that the desired lines are now relocated to the end of the text as seen here:
Now that the lines containing test data are grouped together along with the column headings, we can use an isolation block to reorder the three columns of data:
The IsolateLines command isolates all lines to the end of the text beginning with the first one containing "Wgt". At this point in the pipe, if you use the Run-to-Cursor feature, all you will see are the following lines:
The absence of the report's other lines here doesn't mean that they have been filtered out. To the contrary, they're just being ignored by TEXTools until the EndIsolate command is reached. Next, the ReorderColumns filter is then applied to reorder the columns of data in the isolated lines:
Next, the EndIsolate command then re-joins the isolated text with the rest of the report's text:
The columns of test data are now reordered properly but the affected lines are still at the end of the text where we had grouped them. To return the text to its original state, we simply sort the lines using the line numbers that were inserted earlier and then we remove the inserted line numbers:
This gives us the desired output:
Notice that our pipe hasn't altered any of the report's text except for those lines that contain test data. Furthermore, notice it manages this feat in only 8 lines of "code"! Following is the complete pipe with added comments:
|
|
|
[Home] [Contact Us] [Downloads] [Purchase/Register] |
|
|
Copyright © 2005 Firefly Software |
|