Use conditions

Tekla Tedds
2022
Tekla Tedds Tekla Tedds for Word

Use conditions

The condition function allows you to give alternative results based on whether the value of a particular condition is True or False. You can use the condition function with Input, Show, Message, and Log fields.

Note:

The following only applies to Tedds for Word.

Condition syntax

The condition syntax for each of the eventual conditional fields is:
  • Input($prompt$, $variable name$, $units$, #default value# or $default value$ , [#control flag#], (if¡condition¡, $true text$, $false text$))

  • Show(if¡condition¡,$true text$, $false text$, ¡control flag¡, ¡format flag¡, #control flag#)

  • Message(if(¡condition¡, $true text$, $false text$), $message title$, [¡control flag¡])

  • LogText(if(¡condition¡,$true text$,$false text$))

The parameters are:
  • ¡condition¡ is the condition which controls the field and determines whether the true text or the false text will appear in your document.

  • $true text$ is the text which is displayed if the value of the condition is True. You can use the string function to add values of variables into the text.

  • $false text$ is the text which is displayed if the value of the condition is False. You can use the string function to add values of variables into the text.

Condition function example

Consider the Input field syntax below:

Input("Input the bar diameter - minimum "+String(D_{min},"F0","mm")+" mm","Dia","mm", if(D_{min}>Dia, string(D_{min},"F0","mm"), string(Dia,"F0","mm")),2)

In this case, the default value for the variable Dia depends on whether the minimum bar diameter is greater than the actual diameter.

You can see this more clearly if we isolate the condition from the rest of the field:

if(D_{min}>Dia, string(D_{min},"F0","mm"), string(Dia,"F0","mm"))

If we further remove the string expressions, replacing them with D_{min} and Dia we get

if(D_{min}>Dia, D_{min}, Dia) .

Now the condition is much easier to see: if D_{min} is greater than Dia, the input dialog has its default value set to D_{min}.

If D_min is less than or equal to Dia, then its default value will be set to Dia.

Note:

If you want to use complex conditions in your calculations, you may find it useful to create the overall structure of the field, and then divide the field syntax into pieces.

You must use expression text format for non alphanumeric characters.

Var det här användbart?
Föregående
Nästa