+1 571-297-6383 | info@sonjara.com

A couple of format() improvements

While I iron out the bugs in the Eclipse Assistant, here are a couple of extra little features for the format() method:

Default value specification

Syntax:  {field|alternate}
Example: {name|N/A}

In the above example "N/A" would be output if the name field is empty or null. This will also work with numeric fields with a value of 0 and booleans with false. Very useful for places where you are linking to a form by name or title.

Inline static method call

Syntax:  {class::method}
Example: {MyHelper::getComplicatedOutput}

This works the same as passing array(MyHelper, getComplicatedOutput)to a DataListView. It calls the static method getComplicatedOutput() on the MyHelper class, passing the current object in as a parameter. The new inline format means that you can use it as part of more complicated expressions like:

"{name} - {MyHelper::getComplicatedOutput}"

That's all for now, but it's enough for me. Cheers!

« Enhanced Database Joins
 

Comments

* indicates required field