• Login
sketchucation logo sketchucation
  • Login
⌛ Sale Ending | 30% Off Profile Builder 4 ends 30th September

If statements and missing attributes

Scheduled Pinned Locked Moved Dynamic Components
sketchup
2 Posts 2 Posters 720 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    Pete
    last edited by 8 Nov 2012, 00:25

    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.

    1 Reply Last reply Reply Quote 0
    • J Offline
      Jim
      last edited by 8 Nov 2012, 09:12

      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?

      Hi

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      1 / 1
      • First post
        2/2
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement