[CONNECT Update 15 C++] Display Rule API

When I create a Display Rule manually it works...

Display Rule

When I write the same rule using code...

DisplayRulePtr displayRule = mgr.MakeRule (L"ELEMENT.Area Feature.occupied=No");

Display Rule

The Display Rules dialog tells me Unrecognized criteria!  There is no further explanation.  How can I diagnose problems with Display Rules?

You can reproduce this using the delivered SDK example ..\View\DisplayRule.  If I use that example's command to add a rule, it also fails when the rule involves an Item Type; the code succeeds if it concerns a raw element property.

The failure seems to occur when setting a rule for an Item Type property value.  Is there something about Item Types that affects the way in which a rule should be specified?

Parents Reply Children
  • Have you followed my test steps strictly?

    I've finally solved my problem, after following your advice to be strict!

    Here's a display rule definition that is incorrect...

    Bad Display Rule

    And here's a correct definition...

    Good Display Rule

    Spot the difference!  I'll help you: in both rule definitions I include the Item Type library name, schema name and property name, separated by double-colons (the Area Feature looks odd because there's a space in its name)...

    DgnCustomItemTypes_AreaAnnotator_1_0::Area__x0020__Feature::occupied

    In the good definition, the Display Rules dialog displays the accepted expression as ELEMENT.Area Feature.occupied.

    In the bad definition, the Display Rules dialog displays the message 'Schema not found: DgnCustomItemTypes_AreaAnnotator_1_0'.  But, if you examine the definition, you can see that the schema name is exactly the same in both cases.  The cause of my trouble is my spelling of the property occupied.  When a capitalised name is used (Occupied)  then the Display Rules dialog tells me that the schema is incorrect, which I hope you'll agree is a misleading diagnostic message.

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: Jon Summers