Originally Posted by
stelthorst
Can someone help me out with this formula. I don't know what I'm doing wrong. For some reason my schedule table shows the formula and not the result. Although in the schedule table the PSD values are shown and not the PSD.
If "[ConduitObject:ConduitSize]<= 2" Then
RESULT= "[ConduitObject:Length]+24"
ElseIf "([ConduitObject:ConduitSize]>2 And [ConduitObject:ConduitSize]<= 3 )" Then
RESULT= "[ConduitObject:Length]+36"
Else
RESULT= "[ConduitObject:Length]+48"
End If
Thanks in advance,
When a formula fails, the failed formula, with values being evaluated for that object, is displayed as a means of helping to debug the problem. While not always helpful, there have been times where I have worked out the error by noticing that the value substituted in at a particular place was not what I expected.
That said, you have some extra quotation marks and parentheses in your formula. I do not have ABS, so I had to fake things in ADT 2007, using lines for conduits, but the attached file shows the following formula doing what I believe is the intent of your formula.
Code:
If [ConduitObject:ConduitSize] <= 2 Then
RESULT=CDbl( [ConduitObject:Length] + 24 )
ElseIf [ConduitObject:ConduitSize] > 2 And [ConduitObject:ConduitSize] <= 3 Then
RESULT= CDbl( [ConduitObject:Length] + 36 )
Else
RESULT= CDbl([ConduitObject:Length] + 48 )
End If
I tossed in the CDbl on the RESULT lines to force the results to be interpreted as real numbers, so that the Length - Long formatting I applied to the formula property [Test, in the FormulaTest PSD] would show feet and inches. I also created a Property Data Format called Standard-8, which is a copy of the out-of-the-box Standard PDF, with the precision increased to eight decimal places and zero suppression turned off. That allows the numbers in the Length and ConduitSize properties to maintain the highest level of precision when brought into the formula for evaluation. You may not need that level of precision [if I recall correctly, conduit sizes are do not vary by that small of an increment], but there may be occasions when the Standard PDF's three decimal place precision is insufficient.
I also noticed a strange effect - I initially set up the formula property with the Standard PDF on the Length and ConduitSize properties and that was the PDF listed in the test area in the lower right when editing the formula property. The Standard PDF remained in the test area even after I changed it to Standard-8 on the properties themselves, and when entering values in the test lines in the file, the results were coming out as if three-decimal place precision were in effect. I was puzzled by this, and it was only by luck that I eventually noticed the PDF assigned in the test area. Changing that to Standard-8 made the results in the drawing work as expected. I will need to look at this more deeply when I have time.