Writing Tedds calculations - stage 2 (Australian design example)
In this exercise we will investigate the use of math and data functions to build on the stage 1 calculation, extending its capabilities and introducing some more Tedds features.
Allow about 30 minutes to complete this exercise.
Buttons used in this exercise
Defining input variables
Here are the new calculations we will add to the document you created in exercise 2 in order to check the adequacy of an actual section.
- Type the first two paragraphs, which are just text, below the existing calculation.
- Type the third paragraph and note that here we are defining three input variables which are properties of the section we are checking. Ensure you separate the text and all the expressions using delimiters (;) as shown.
Tedds math functions
Result accuracy and formats
It is sufficient to display the slenderness to one decimal place. To do this we use a format string to override the default result setting of three decimal places.
- Now type the last paragraph of the new calculations as follows. Use the Greek text button as you did on page 32 for the variable name λ.
- The characters f1 following the ? are the format string. The format string must immediately follow the ? with no space in between as shown. See below for a fuller explanation.
- Once you have finished typing this last expression, check the new paragraphs carefully. Have you included all the delimiters? Have you used subscripts correctly? Have you used the correct case for variable names and units?
- When you are satisfied that everything is correct, click the Calculate All button. A math function is always followed directly by its argument(s) in parentheses as shown here. There are many more such functions available in Tedds for Word. For full details of this and other functions, consult the Tedds Help system topic Mathematics, or refer to the Writing your own custom calculations Index item in the Library Access System, where all functions are completely documented.
- If you have an Error, then Interrupt and see Errors and troubleshooting. Fix any errors until your calculation works fully.
- Review your results and look at the last paragraph to see how the format string we used has operated:
- Click the Variables button to examine the list of saved variables and check the stored value for this variable:
Result Format Strings Explained |
---|
You can override the default result setting, and reduce or increase the number of decimal places for a displayed result, by using a result format string after the ? result field. For example typing ?f2 will display the result to two decimal places. It is important that there is no space between the format string and the ?. The format string characters signify the following: f = fixed format, and 2 = result to be displayed to 2 decimal places (can be from 0-15) Note that format strings only control the precision of the result displayed in the document, not any result that is stored by Tedds. For full details of this and other result formats, consult the topic Result formats and precision. |
Using data functions in calculations
The calculation as written is very useful, but we can enhance it further. One big improvement is to include a Data List in the calculation, making the properties of a huge number of section types and sizes instantly available.
- First edit the two paragraphs underneath the heading Check Section; as follows:
- Delete the following text for the section name - Try a 150 Parallel Flanged Channel. Leave an empty line here.
- Next delete just the values for the properties of the section. Replace them with a ? result field. You should end up with the following:
- Finally, place your cursor as shown at the very end of the heading.
Retrieving Data Lists from the library
Tedds fields
- Check the Field Codes box.
- Look at the Tedds Field in your document and you will see the following:
- The command that runs the Data List is now revealed. Uncheck the Field Codes box again to return to the normal view of the document.
Tedds Fields Explained |
---|
Field Codes enable you to see and thus edit the hidden commands which are Tedds Fields. These commands run special functions in Tedds like the Data Lists. We will see some more Tedds Fields shortly. A Tedds Field will run when it is calculated, like any normal expression. We hide the Tedds field, since you would not want it to appear in a printed report. The Field Codes button reveals the Tedds Fields. Tedds Fields should be treated like expressions, and separated from text and other expressions in the same paragraph using semi-colons. |
What next?
Congratulations! You have completed the fourth exercise and learned everything you really need to write powerful Tedds calculations. Maybe now would be the time to have a go at writing a calculation of your own. It's a good idea to start with something simple and build on the complexity as you become more familiar with Tedds.
The next step in the guide, Enhancing Calculations is about making Tedds calculations still easier to work with, and is especially relevant if you envisage writing calculations for others to use. Even if your calculations are for your own use you may find these further features beneficial so we recommend that you review them. You might like to leave this step until you have had a go at writing a calculation of your own using what you have learned so far.