Jump to content
Changes to the Jaspersoft community edition download ×

A recipe for Turing-complete logic in reports


Recommended Posts

The report environment is obviously not the right place to perform complex logic, but when needs must the lack of lambda support in the available JS and troubles getting java 8+ working make a solution desirable. This technique worked for me, and I thought it might be of interest:

<textFieldExpression><![CDATA[    (function () {       var a = new Object($F{top}.get("buss"));        var b = ...;       for (var p in a) {           b.push(a[p]);       }       return ...;    }    ).apply()]]></textFieldExpression>[/code]

Notice the use of a "for" loop and temporary "var"s! This works because the "()" around the "function () {}" turns the declaration into an expression, which ".apply()" can run.

Enjoy responsibly...

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...