What are Tedds Fields?
Before we discuss what a Tedds field is, we must first consider what a Microsoft Word field is. Quoting from the Word documentation "A field is a placeholder for data that might change in a document". Fields are automatically inserted by Word when you use particular commands, such as the Date and Time command on the Insert menu.
Microsoft Word Fields
A field consists of two parts a field code and a field result. Field codes appear between curly brackets, or braces ( { } ). Fields are similar to a formula in Microsoft Excel; the field code is like the formula, and the field result is like the value that the formula produces. You can switch between viewing the field codes and results in your document.
Let's demonstrate field codes with an example, before you start make sure Tedds for Word is running and that a blank document is open.
- On the Insert menu click Date and Time...
- In the Available formats box click the long formatted date that includes the name and day number, the month name and the year.
- Check the Update automatically box to ensure that a field is used to insert the date.
- Click OK.
You should now see in your document the current date similar to the following:
Thursday January 10, 2013
Now point the mouse cursor at the date and click the right mouse button to show the field context menu, then click the Toggle field codes option. This command will toggle between viewing the field result and the field code. You should now see in your document the field code for the date field:
{ DATE @"ddd, dd MMMM yyyy" }
This is the field code that tells Microsoft Word to show the current date in the required format when the field results are shown.
Note: Fields may be displayed in your document with a light grey background, this can help you to identify which text in your document is the result of a field as apposed to normal text. To change this option:
In Word you can click the Word button in the upper left corner and go to Word Options > Advanced > Show document content > and choose to show field shading when selected.
For more information about Word fields click Microsoft Office Word Help on the Word Help menu, then search for about fields.
Tedds Fields
Microsoft Word defines many different field codes to view different types of data from dates and times to page numbers. Tedds for Word supports it's own field codes that are provided specifically for writing calculations.
Tedds fields codes always begin =CSC| this ensures that when Tedds is calculating it knows that the field is a Tedds field and that it must be calculated by Tedds to output the desired field result.
Note: Tedds fields are sometimes referred to as Call Statements because many of the field codes start with the command CALL and are used to call a specific Tedds command.
Let's demonstrate Tedds field codes by using the Show statement as an example, before you start make sure Tedds for Word is running and that a blank document is open.
- In the Tedds ribbon click Tedds Fields
- Click the Show tab.
- Select Simple from the type box.
- In the Text box, type "This is a Tedds Field".
- Click OK.
You should now see in your document a single semicolon:
;
The semicolon has been inserted immediately after the new Tedds field, the semicolon is a delimiter used to separate the field from any calculations that may follow. Now in the Tedds ribbon under the Show/Hide menu check on the Field Codes item and you will see the following field code:
{ =CSC|CALL Show("This is a Tedds field", Show, True, True ) };
This Tedds field code tells Tedds to output the field result "This is a Tedds field Code" when the field is calculated. Calculate the Tedds field using the Calculate Expression command from the Calculate menu in the Tedds ribbon. When Tedds has finished calculating you should see in your document the text:
This is a Tedds field;
Tedds has calculated the field code and updated the field result with the result of the Show command. The simple show command as defined in this example outputs the text specified in quotes, for more information about using the Show command please refer to the Tedds documentation.
Click in the middle of the field result and type the text "some more text in " so that the field result looks like the following:
This is some more text in a Tedds field;
You have now manually updated the field result by typing directly within the field result. Now calculate the expression again and see what result you get:
This is a Tedds field;
The field result has changed back to the original text and the changes you made have been lost. This has happened because when calculating, the field result is updated with the new calculated result. If you want to change the text in a field result you must change the field code so that when calculated it will output the desired result:
{ =CSC|CALL Show("This is some more text in a Tedds field", Show ) }