I have an object anchored to another all with the following properties:
Space_Prop - PSD
Total_Floors = Building_Floors + Podium_Floors
What formula would i need for [Total_Floors] to say something similar to this :
IF Podium_Floors = *Anchor cannot be found*, Then RESULT = 0
ElseIF, RESULT = [Building_Floors] + [Podium_Floors]
Solved! Go to Solution.
This doesnt work, but it should be something like this ?
PF = [Podium-Objectodium_Floors]
If PF = *Anchor not found* Then
RESULT = [Block-Object:Building_Floors]
RESULT = [Block-Object:Building_Floors]+[Podium-Objectodium_Floors]
Almost, but not quite. You corrected the syntax on the If statement, but now your problem is that when you have an Anchor property on an object that is either not anchored, or is anchored to an object that does not have the PropertySetroperty specified in the Anchor property attached, while the result is displayed as *Anchor not found* and might appear to be a string value, the actual value is an error condition, so any formula property that directly evaluates the Anchor property will fail.
The work around is to bring in the Anchor property enclosed in quotation marks, so that it becomse a string, and then to process it accordingly. You did not provide a sample file, so I have no idea what types of objects you are using or how they are anchored, but assuming [Podium_Floors] is a reference to an Anchor property in the current Property Set and that it references a numeric property in the object to which the object that has this Property Set attached is anchored, and [Building_Floors] is a reference to a numeric property in the current Property Set, then this should work for you:
If "[Podium_Floors]" = "*Anchor not found*" Then
RESULT = [DoorProp01]
RESULT = [DoorProp01] + CDbl ( "[Podium_Floors]" )
The CDbl in the Else RESULT line takes the value of [Podium_Floors], which has been made a string, back into a real number. If [Podium_Floors] is an integer value, you could use CInt instead of CDbl.
All items in square brackets ("[propertyreference]") have to be properly created property references in the formula property, and if the source properties have a Property Data Format applied that adds a non-numeric prefix or suffix, you will need to change the Format in the Enter Sample Values area to one that leaves a raw numeric value. If the values are real numbers, you may want to create a Property Data Format that maximizes the precision to minimize rounding issues.
The attached file uses Walls and Doors as a test bed for dealing with Anchor properties. The DP01_plus_WP01 formula property shows that the formula noted above can work. In the file, the GWB and metal stud Wall on the left has the WallObjects01 Property Set attached. The concrete Wall on the right does not. Each Wall has a Door and there is also a free-standing (unanchored) Door. All three Doors have the DoorObjects01 Property Set attached, and the formula property returns a value for all three doors, even though only the Door in the GWB Wall gets a value through the Anchor property.
If you want to read more about handling "*XXX not found*" in formula properties, the following blog article addresses this issue (with a Location property as the source of the "not found" property, but it also applied to Anchor properties):