Schema - "complex" criteria

Wise forum folks,

One more question for you.  XFM Schema appears to have difficulty with interpreting "complex" criteria (e.g., criteria that reference more than one attribute), such as:

     ([attribute1]>0) && ([attribute2]<100)

Or even better:

     COMPARE("[attributea]","True","") && ([attributeb]>0)

I couldn't find guidance in the Help files addressing situations like this.  Has anyone else tried something similar?

Thanks.

Janice

Parents
  • Hi. This should work. You can refer to an example in the geo_example schema that is delivered with Bentley Map. Look at the road_name criteria.

       Martin

      

  • Martin - thanks, I'll take a look at the example schema.  Might come back with some more questions after that.

    Janice

  • COMPARE function allows passing a delimeter string in the last parameter to compare a value against a delimited list of possible values.

    For example...

    From "Performance Notes" paragraph in the XFM Overview section of the Bentley Map Customization Guide (search for  "Performance Notes"):

    If you need to compare a single property to numerous values then use the COMPARE function with a delimited list of values instead of separate COMPARE functions.

    Instead of: COMPARE("[SIZE]","220","") || COMPARE("[SIZE]","240","") || COMPARE("[SIZE]","640","")

    Consider using: COMPARE("[SIZE]","220|240|640","|")

    Regards,

    Chris


    This is a test

  • For your example # 2: COMPARE("[attributea]","True","") && ([attributeb]>0)

    Ensure that attributeb has a value or the expression evaluation will fail.  You could accomplish this by specifying a default value in the expression:

    ([attributeb|0]>0)

    To specify a default value, add a vertical bar character followed by the default value after the property name.


    This is a test

  • Thanks for pointing that out.  I actually have a number of instances where I *want* the expression to fail.  Take my example #2 -

        COMPARE("[attributea]","True","") && ([attributeb]>0)

    When this expression is true, I want to place a cell (Cell B) containing PBA Replacement Text that is populated by Attribute B.  When there is no Attribute B, this expression obviously fails, and Cell B is not placed.  In this case (Attribute B does not exist), I actually prefer to place another cell (Cell A), so I've written another expression to "catch" this:

        COMPARE("[attributea]","True","")

    As you point out, I just need to make sure that the first expression appears first in the .xml hierarchy so that it's evaluated first - otherwise, the second expression will take precedence (and Cell A will be placed for each instance, regardless of whether Attribute B exists or not.)

    Side note: I don't want to pass a default value in the expression (as you suggested) for various reasons.  For one thing, the default value would end up populating the PBA Replacement Text, and I don't want that...

    Just curious, can I write an expression that queries whether or not Attribute B *exists*?  What syntax would I use?

    Thanks,

    Janice

  • Clarification on the default value syntax.  The default value is only used in the expression when the property has no value just so that we produce a syntactically correct expression.  The default value is not set into the property in the feature instance.  So you would not later see this default value in the PBA replacement text.

    Regarding checking if a property exists, I'm thinking that you mean, does my property have a value? You could check if a property has a value by checking the property's value string length.  

    Check if the length of a feature's property value is not zero using the C string length function "strlen".

    0!=strlen("[feature_instance_alias:property_name]")


    This is a test

Reply
  • Clarification on the default value syntax.  The default value is only used in the expression when the property has no value just so that we produce a syntactically correct expression.  The default value is not set into the property in the feature instance.  So you would not later see this default value in the PBA replacement text.

    Regarding checking if a property exists, I'm thinking that you mean, does my property have a value? You could check if a property has a value by checking the property's value string length.  

    Check if the length of a feature's property value is not zero using the C string length function "strlen".

    0!=strlen("[feature_instance_alias:property_name]")


    This is a test

Children
No Data