Monday, October 26, 2009

Using IIF with ColdFusion Report Builder

I was trying to do some conditional logic in coldfusion report builder and having some problems. Evidently the problem was with my misunderstanding of IIF. I was trying the following:

IIF (len(myvar), myVar, myVar2)

The way IIF works is that it expects strings, indicating variables, which to me is counterintuitive. But the solution that worked was:

IIF (len(myvar), 'myVar', 'MyVar2')

This evaluated to the correct values of those variables and works great.

No comments: