Mathematics

Tekla Tedds
2022
Tekla Tedds Tekla Tedds for Word

Mathematics

In the following paragraphs, we cover the mathematical operators and functions available in Tedds for Word.

Operators

The following mathematical operators are available in Tedds for Word.

Tip:

You can find the symbol form of most of the following operators in the Library Access System. Go to Writing your own custom calculations > Calculation writing documentation > Math symbols.

Operator Description
Addition
Subtraction
* or Multiplication
/ or Division
yx Raises y to the power of x
Note:

The maximum and minimum numbers that Tedds can handle are 10308 and 10-308.

Mathematical functions

The following mathematical functions are available in Tedds for Word.

Tip: You can find most of the following functions in the Library Access System. Go to Writing your own custom calculations > Calculation writing documentation > Maths functions.
General mathematical functions
Function Description Limits and notes
xy Raise x to the power y x > 0
sqrt(x) Square root of x x > 0
√(x) Square root of x x > 0
exp(x) Exponential ex Not applicable
ln(x) Natural log of x x > 0
log(x) Log to the base 10 of x x > 0
abs(x) Absolute value of x Not applicable
degrees(x, y, z) Converts x° y' z'' to x.ddd° Not applicable
max(x,y,z,…) Maximum number in list Not applicable
min(x,y,z,…) Minimum number in list Not applicable
sum(x,y,z,…) Summation of numbers in list Not applicable
average(x,y,z,…) Average of number in list Not applicable
median(x,y,z,…) Median number in list Not applicable
quotient(x,y) Integer portion of x/y Not applicable
mod(x,y) Remainder on dividing x by y Not applicable
int(x) Integer part of x Not applicable
int(x, "unit") Integer of x when expressed in terms of "unit" Not applicable
round(x, y) Rounds x to y decimal places -15 < y < 15
round(x,y,"unit") Rounds x to y decimal places when expressed in terms of "unit" Not applicable
rand() Random number between 0 and 999 Not applicable
increment(x) increment(x,y) Increment x by y, if y not specified increment x by 1 No limits; works with units
floor(x,y) Rounds x down to the multiple of significance y No limits; works with units
ceiling(x,y) Rounds x up to the multiple of significance y No limits; works with units
Trigonometric mathematical functions
Function Description Limits
sin(x) Sine (x in degrees) Not applicable
cos(x) Cosine (x in degrees) Not applicable
tan(x) Tangent (x in degrees) Not applicable
cosec(x) Cosecant (x in degrees) Not applicable
sec(x) Secant (x in degrees) Not applicable
cot(x) Cotangent (x in degrees) Not applicable
asin(x) Inverse sine (result in degrees) -1 <= x <= 1
acos(x) Inverse cosine (result in degrees) - 1 <= x <= 1
atan(x) Inverse tangent (result in degrees) Not applicable
sinh(x) Hyperbolic sine Not applicable
cosh(x) Hyperbolic cosine Not applicable
tanh(x) Hyperbolic tangent Not applicable
asinh(x) Inverse hyperbolic sine Not applicable
acosh(x) Inverse hyperbolic cosine x >= 1
atanh(x) Inverse hyperbolic tangent - 1 <= x <= 1
Note: All functions that take angle arguments expect them in degrees, and all functions that return angle arguments return them in degrees.

Tedds functions

The following Tedds functions are available in Tedds for Word.

You can find most of the following functions inLibrary Access System. Go to Writing your own custom calculations > Calculation writing documentation > Tedds functions.

String functions
Function Description
StrLength("String1")

Returns the number of characters in the given string.

If a string variable is given as the parameter, the function returns the number of characters in the variable.

StrCompare("String1", "String2", CaseInsensitive)

Compares two strings to see if they are equal.

The comparison can be case sensitive or case insensitive.

If the strings are equal, the function returns 0. If String1 is less than String2, the function returns -1. If String1 is greater than String2, the function returns 1.

StrEndsWith("String1", "String2")

Checks to see if String1 ends with String2, returning 1 if it does and 0 if it does not.

The comparison is always case sensitive, and the function recognizes spaces.

StrInsert("String1", "String2", InsertPosition)

Inserts String2 into String1 at the position specified by the InsertPosition parameter.

StrFirstIndexOf ("String1", "String2", SearchStartPosition, SearchRangeLength)

Finds the first instance of String2 within String1 after SearchStartPosition and returns the position of the first character.

If String2 is not found within SearchRangeLength characters, the function returns -1.

SearchStartPosition (the number of characters from the start of String1 at which the search will start) and SearchRangeLength are optional.

StrLastIndexOf("String1", "String2", SearchStartPosition, SearchRangeLength)

Finds the first instance of String2 within String1 after SearchStartPosition, and returns the position of the first character.

If String2 is not found within SearchRangeLength characters, the function returns -1.

SearchStartPosition (the number of characters from the start of String1 at which the search will start) and SearchRangeLength are optional.

StrPadLeft("String1" the function returnstringLength, "String2")

Pads the left hand side of String 1 with sufficient characters to make it as long as the length specified by ReturnStringLength.

String2 is optional. If String 2 is not specified, String1 will be padded with spaces. Otherwise, it will be padded by the characters of String2.

StrPadRight("String1" the function returnstringLength, "String2")

Pads the right hand side of String 1 with sufficient characters to make it as long as the length specified by ReturnStringLength.

String2 is optional. If String 2 is not specified, String1 will be padded with spaces. Otherwise, it will be padded by the characters of String2.

StrRemove("String1", DeleteStartPosition, NumberOfCharsToDelete)

Removes the number of NumberOfCharsToDelete characters from String1, starting at DeleteStartPosition.

StrReplace("String1", "Remove", "Replace")

Scans String1 and replaces all instances of the Remove string with the Replace string.

If the Replace string is the empty string "", the function removes all instances of the Remove string completely.

StrStartsWith("String1", "String2")

Checks to see if String1 starts with String2, returning 1 if it does and 0 if it does not.

The comparison is always case sensitive, and the function recognizes spaces.

StrSubstring("String1", SubstringStart, SubstringLength)

Obtains a string from the middle of String1 which is has as many characters as defined in SubstringLength, starting at SubstringStart.

If you don't specify SubstringLength, the returned string will be the remainder of String1 from SubstringStart.

StrToLower("String1")

Converts String1 to lower case characters.

StrToUpper("String1")

Converts String1 to upper case characters.

StrTrim("String1", "UnwantedCharacters")

Removes UnwantedCharacters from the start and end of String1.

The UnwantedCharacters parameter is optional. If not specified, the function removes spaces from the start and end of String1.

StrTrimStart("String1", "UnwantedCharacters")

Removes UnwantedCharacters from the start of String1.

The UnwantedCharacters parameter is optional. If not specified, the function removes spaces from the start of String1.

StrTrimEnd("String1", "UnwantedCharacters")

Removes UnwantedCharacters from the end of String1.

The UnwantedCharacters parameter is optional. If not specified, the function removes spaces from the end of String1.

StrStart("String1", SubstringLength)

Obtains a string which has as many characters as defined in SubstringLength from the start of String1.

StrEnd("String1", SubstringLength)

Obtains a string which has as many characters as defined in SubstringLength from the end of String1.

StrFormat("String1", Value1, Value2, …)

Creates complex strings that contain values.

Placeholders represent the position of the values in the string, and can specify formatting information for the value.

String ("VariableName or formula", "format", "unit")

Converts a number variable (or a formula yielding a number) into a string, and controls the formatting of the string value.

The format parameter is optional. If it is omitted, the default format is adopted.

The unit parameter is optional. If it is not used and the value has dimensions, base system units are used.

Str ("VariableName or formula")

Converts an integer number variable (or a formula yielding an integer number) into a string.

EvalString("String1")

Evaluates the string as though it were an expression.

Unit functions
Function Description Note
addunit("x",a,b,c,d,f)

Adds unit x to the unit database.

a, b, c and d are the powers of the unit dimensions (Ma, Lb, Tc, Dd), and f is the multiplication factor to turn the base unit combination to the unit to be added.

In order to use this function, you must be the only one using the units database file.
getunit("x")

Lists the dimensions and the multiplication factor for unit x.

Not applicable
listallunits()

Lists all units in the units database.

Not applicable
removeunit("x")

Removes unit x from the units database.

In order to use this function, you must be the only one using the units database file.
showdims("x")

Shows the dimensions of variable x.

Not applicable
Logic functions
Function Description
If(condition,x,y)

If condition is true, the function returns x. Otherwise, the function returns y.

if(and(a<b,c>d),x,y), if((a<b)&&&&(c>d),x,y)

If both conditions are true, the function returns x. . Otherwise, the function returns y.

if(or(a<b,c>d),x,y), if((a<b)||(c>d),x,y)

If either condition is true, the function returns . Otherwise, if not then returns y.

ifelseif(a>b, v, c<d, w, a==0, x, d<>a, y, z)

If a>b, the function returns v. If not, the function checks if c<d, and if it is true, the function returns w. The function continues working this way, and if no conditions are matched the function returns z.

Not(a>b)

If the specified condition is met (a>b), the function returns 0. Otherwise, the function returns 1.

Select(variable name, variable value 1,return value1, variablevalue 2, return value2,variable value 3, returnvalue3, variable value 4,return value4, return value 5)

Returns the value of a variable based on the value of another variable.

Example:

Day = "Sun" Select(day,"Mon",2,"Tue",3,"Wed",4,"Thur",5,"Fri",6,"Sat",7,1) = 1.

The function returns 1 because it does not match any of the values. If day were "Wed", the function would return 4.

Conditions that apply to logic functions
Conditions Description
x > y, x > y

Greater than.

The function returns 1 if true, 0 if false.

x >= y, x ≥ y

Greater than or equal to.

The function returns 1 if true, 0 if false.

x == y, x == y

Equal to.

The function returns 1 if true, 0 if false.

x <> y, x ≠ y, x != y

Not equal to.

The function returns 1 if true, 0 if false.

x <= y, x ≤ y

Less than or equal to.

The function returns 1 if true, 0 if false.

x < y, x < y

Less than.

The function returns 1 if true, 0 if false.

Equality functions
Function Description
_eq(x,y,Tolerance)

Checks that x and y are equal within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x and y must be equal to the full accuracy of Tedds calculations.

equal(x,y,Tolerance)

Checks that x and y are equal within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x and y must be equal to the full accuracy of Tedds calculations.

_lt(x,y,Tolerance)

Checks that x is less than y within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x must be less than y to the full accuracy of Tedds calculations.

lessthan(x,y,Tolerance)

Checks that x is less than y within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x must be less than y to the full accuracy of Tedds calculations.

_gt(x,y,Tolerance)

Checks that x is greater than y within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x must be greater than y to the full accuracy of Tedds calculations.

greaterthan(x,y, Tolerance)

Checks that x is greater than y within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x must be greater than y to the full accuracy of Tedds calculations.

_le(x,y,Tolerance)

Checks that x is less than or equal to y within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x must be less than or equal to y to the full accuracy of Tedds calculations.

lessorequal(x,y, Tolerance)

Checks that x is less than or equal to y within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x must be less than or equal to y to the full accuracy of Tedds calculations.

_ge(x,y,Tolerance)

Checks that x is greater than or equal to y within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x must be greater than or equal to y to the full accuracy of Tedds calculations.

greaterorequal(x,y, Tolerance)

Checks that x is greater than or equal to y within the specified Tolerance.

The function returns 1 if it is true, 0 if not.

Tolerance is an optional parameter. If it is not specified, x must be greater than or equal to y to the full accuracy of Tedds calculations.

Variable functions
Function Description
Delete VarsInSection("x","y","z"…)

Deletes the variables x, y and z in the current calculation section.

If no variables are specified, the function deletes all variables in the current section.

Delete VarsInAllSections(("x","y","z"…))

Deletes the variables x, y and z in the current document.

If no variables are specified, the function deletes all variables in the document.

Delete VarsInSectionExcept("x","y","z"…)

Deletes the all the variables other than x, y and z in the current calculation section.

Note:

The variables that are not to be deleted must be specified. Otherwise, the function generates an error.

GetVar("VariableName", defaultValue)

Gets the value of a variable.

If the specified variable does not exist, the function sets the variable to the default value.

The defaultValue parameter is optional. However, the function generates an error if the variable is not found.

SetVar("VariableName", Value)

Sets the value of the variable to the specified value.

GetSectionVar(SectionId, "VariableName", defaultValue)

Gets the value of a variable from the section with the ID SectionId.

If the specified variable does not exist, the function sets the variable to the default value.

The defaultValue parameter is optional. However, the function generates an error if the variable is not found.

SetSectionVar(SectionId, "VariableName", Value)

Sets the value of the variable in the section with the ID SectionId to the specfied value.

GetDocumentVar (SectionId, "VariableName", defaultValue)

Gets the value of the document variable.

If the specified variable does not exist, the function sets the variable to the default value.

The defaultValue parameter is optional. However, the function generates an error if the variable is not found.

SetDocumentVar (SectionId, "VariableName", Value)

Sets the value of the document variable to the specified value.

PromoteVariable("var1", "var2",…)

Promotes the variables "var1", "var2", and so on in the current calculation section, making them document variables.

VarExists("VariableName")

Checks to see if a variable exists.

If it does, the function returns 1. Otherwise, the function returns 0.

Calculation section functions
Function Description
GetSectionId()

Returns the ID of the calculation section that contains the insertion point.

If the insertion point is not in a calculation section, the function returns 0.

GetSectionName()

Returns the name of the calculation section that contains the insertion point.

If the insertion point is not in a calculation section, the function returns "".

GetSectionVar(SectionId, "VariableName", defaultValue)

Gets the value of a variable in the section with the ID SectionId.

If the specified variable does not exist, the function sets the variable to the default value.

The defaultValue parameter is optional. However, the function generates an error if the variable is not found.

SetSectionVar(SectionId, "VariableName", Value)

Sets the value of the variable in the section with the ID SectionId to the specified value.

GetDocumentVar (SectionId, "VariableName", defaultValue)

Gets the value of the document variable.

If the specified variable does not exist, the function sets the variable to the default value.

The defaultValue parameter is optional. However, the function generates an error if the variable is not found.

SetDocumentVar (SectionId, "VariableName", Value)

Sets the value of the document variable to this value.

Calc library functions
Function Description
CalcItemExists ("fileName", "itemName")

Checks to see if an item named itemName exists in the library named fileName.

The function returns 1 if it does, 0 if it does not.

GetCalcItemLongName ("fileName" , "itemName")

If an item named itemName exists in the library named fileName, the function returns its long name. If it does not, the function returns the empty string "".

GetCalcItemDescription ("fileName", "itemName")

If an Item named itemName exists in the library named fileName, the function returns its description. If it does not, the function returns the empty string "".

GetCalcItemVersion ("fileName", "itemName")

If an item named itemName exists in the library named fileName, the function returns its Version information. If it does not, the function returns the empty string "".

GetCalcItemAuthor ("fileName", "itemName")

If an item named itemName exists in the library named fileName, the function returns its Author information. If it does not, the function returns the empty string "".

GetCalcItemStatus ("fileName", "itemName")

If an item named itemName exists in the library named fileName, the function returns its Status information. If it does not, the function returns the empty string "".

GetCalcItemText ("fileName", "itemName")

If an item named itemName exists in the library named fileName and is a text item, the function returns its contents. If the item does not exist or is not a text item, the function returns the empty string "".

GetCalcItemProperties ("fileName", "itemName", "longName", "description", "version", "status", "author")

If an item named itemName exists in the library named fileName, the function returns all its properties into the variables named "longName", "description", "version", "status", "author" (these must be enclosed in quotes as shown here). If it does not, the function returns empty strings "".

SetCalcItemLongName ("fileName", "itemName", "Value")

If an item named itemName exists in the library named fileName, sets its Long name to Value.

SetCalcItemDescription ("fileName", "itemName", "Value")

If an item named itemName exists in the library named fileName, sets its Description to Value.

SetCalcItemVersion ("fileName", "itemName", "Value")

If an item named itemName exists in the library named fileName, sets its Version to Value.

SetCalcItemAuthor ("fileName", "itemName", "Value")

If an item named itemName exists in the library named fileName, sets its Author to Value.

SetCalcItemStatus ("fileName", "itemName", "Value")

If an item named itemName exists in the library named fileName, sets its Status to Value.

SetCalcItemProperties ("fileName" , "itemName" , "newLongName", "newDescription", "newVersion", "newStatus", "newAuthor")

If an item named itemName exists in the library named fileName, sets its Long name to newLongName, its Description to "newDescription", its Version to "newVersion", its Status to "newStatus" and its Author to "newAuthor".

Locale functions
Function Description
GetLocale()

Returns the current locale to which Tedds is set.

GetCountry()

Returns the current country to which Tedds is set.

Version functions
Function Description
GetTeddsVersion()

Returns the version number of Tedds for Word.

GetTeddsSPVersion()

Returns the service pack version number of Tedds.

GetExcelVersion()

Returns the version number of Excel.

Miscellaneous functions
Function Description
subcall("original function name","parameter 1 of the original function","parameter 2 of the original function" …)

Runs any Tedds for Word function in an interface.

You can use this function to run a data list or a data table by pressing a button in an interface.

GetLanguage()

Returns the user interface language identifier as a two-character string code ("EN" = English, "FR" = French, "DE" = German, "ES" = Spanish).

GetTeddsAppName()

Returns the name of the Tedds application (Tedds or Tedds for Word) calculating the current document.

GetTimer()

Returns the numeric value of the timer.

Pause( time )

Returns the time of a pause in milliseconds.

Example:

Pause( 5000 ) = 1.000 indicates a pause for 5 seconds.

ProgressText( text ) Sets the status text displayed in the Tedds progress window.

Example:

ProgressText( "This is the progress text" ) = 1.000 Pause( 3000 ) = 1.000.

That indicates a pause, so that you can read the text in the progress window.

ResetTimer()

Resets the timer to zero.

ToHex( value )

Returns a value as a hexadecimal formatted string.

Example:

ToHex( 1 ) = "0x1" ToHex( "a" ) = "0x61"

Bylo to užitečné?
Předchozí
Další