If statements and missing attributes
-
Can anyone help me out - I am trying to use an IF(,,) statement but sometimes it fails. This happens when the parent component does not contain the attribute the if statement is looking for, even when the attribute is not being executed on. For instance:
This works:
%(#0040BF)[Parent Component Attributes:
Left Length = 5
Corner Length = 10
Is Corner = "Yes"SubComponent Attributes:
Length = IF(Parent!Is Corner = "Yes",Corner Length,Left Length)]This doesn't work:
%(#0080FF)[Parent Component Attributes:
Left Length = 5
Is Corner = "No"SubComponent Attributes:
Length = IF(Parent!Is Corner = "Yes",Corner Length,Left Length)]I want to be able to insert the subcompnent into a variety of parent componets that all have the Is Corner attribute, but only a few have the Corner Length attribute.
An example of the if statement failing when referenced attribute does not exist.
-
Hi Pete,
There isn't a DC function that I know of to test if an attribute exists.
Maybe you could eliminate the IsCorner attribute, and use an "odd" value in CornerLength to indicate it is not a corner?
Advertisement