Home > Developing Using CodeFluent Entities > CodeFluent Entities: Member Format Expressions (Final Part)

CodeFluent Entities: Member Format Expressions (Final Part)


Last post exploring this feature of the Modeler, detailing what you can do in conditions and the MessagesBrowser class.

Conditions

In the previous post, we’ve seen that we could specify a condition attribute in the <if> and <font> tags. A few notes on the condition attribute:

  • Property paths in condition attributes should not be surrounded by curly brackets (i.e. use IsKey instead of {IsKey}),
  • Shortcuts available on the right side of the statement to ease condition declaration,
  • Therefore prefer placing evaluated values on the left side of the statement rather than on the right.

The following operators are supported:

  • “==” or “=” for a case insensitive equals,
  • “[=CS]” for a case sensitive equals,
  • “!=”, “<>” for a case insensitive not equals,
  • “[!=CS]” for a case sensitive not equals,
  • “>=” for greater than equals,
  • “<=” for lower than equals,
  • “>” for greater than,
  • “<” for lower than,
  • “[StartsWith]” for a case insensitve starts with,
  • “[StartsWithCS]” for a case sensitive starts with,
  • “[EndsWith]” for a case insensitive ends with,
  • “[EndsWithCS]” for a case sensitive ends with,
  • “[Contains]” for a case insensitive contains,
  • “[ContainsCS]” for a case sensitive contains.

Here’s how to highlight all properties ending with “Id”:

<font condition=”Name [EndsWith] ‘Id'” color=’red’>{#Name}<else/>{#Name}</font>

Note: don’t forget to surround the right side statement with quotes so the evaluator knows it’s a string.

Please note that there are also shortcuts such as you don’t have to specify ‘> 0’ for numbers for instance:

{#Name}<font condition=’AllRules.Count’ color=’#007F0E’> (Rules={AllRules.Count})</font>

Will suffix properties with “(Rules=X)” in green:

image

 

The MessagesBrowser Class

The MessagesBrowser class is a class you can use as a property path and which allows you to access messages (a.k.a. resources) defined for the current concept (entity or property). For instance, if you defined English resources for each of your address properties in the documentation class:

image

Using the following expression you can display them:

{#Name} ({MessagesBrowser._doc.en-US})

Here’s the result:

image

Note: As of today, for performance results the MessagesBrowser class is cached and built on first access, so that defining a new resource or editing one will not be reflected on the surface.

Carl Anderson

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s