1 post
User variables in reports?
04.04.2014 21:09

I'm playing around with the reports and template editor in Tekla, trying to assemble my own reports. And I came upon the following problem: let's say I have a rebar schedule. Using a REBAR row works fine to list the different bars in an element. But, let's say I have to apply a factor to the different weights, to compensate for splices (it's a bit easier than modelling splices on complicated rebar arrangements).

So I have my data row:

GRADE_field - SIZE_field - WEIGHT_TOTAL_field - FACTOR_field - WEIGHT_ADJUSTED_field

FACTOR_field is a huge nested IF statement:

if SIZE == 3 then ... else if SIZE == 4 ... else if SIZE == 5 ... else ... endif endif endif

First question: anyone have an easier way to assign factors to 11 different rebar sizes, than to create a huge nested IF? Is there a CASE function or something built into Tekla?

Second question: if I want to calculate WEIGHT_ADJUSTED, which is basically my FACTOR x WEIGHT_TOTAL, could I simply state in the formula:

CopyField("WEIGHT_TOTAL_field") * CopyField("FACTOR_field")

(I tried this one, but it didn't work correctly and would apply the factor from the next row to the current row, am I missing something?)

And third question, which is where it gets interesting. My factors aren't universal constants. Depending on the fabricator, they can go up or down. So every new project, I'd have to dive into that huge 11-level IF statement and start changing factors. Does anyone know if it's possible to define variables to contain the factors inside the formula, so as to not have to dive into the IF statement? What I mean is this:

myvariable1 = 1.02
myvariable2 = 1.03
myvariable3 = 1.04

if SIZE == 1 then myvariable1 else
if SIZE == 2 then myvariable2 else
if SIZE == 3 then myvariable3 else

So if my factors change, I change the starting lines of the function, and the rest stays the same.

Or... is there a way to do this with value fields and then reference those value fields inside my IF statement?