I think @Formula is a frequently forgotten art of Lotus development. Many people start out learning @Formula, then move on to LotusScript and don’t look back. That can be a mistake as @Formula can sometimes be more efficient than LotusScript. There are @functions that just don’t exist in LotusScript, or require fewer lines of code, or take more parameters.

Today I bring you @Transform. @Transform can be used to transform a value, or even better, a list of values. Take for example a list of user-entered values. The values were supposed to be in percentages. Some users entered “50″ meaning 50% and others entered “0.50″ also meaning 50%. How can we take the list of values and only change those that were in the incorrect format? @Transform, of course!

We’d like to show all of our values in decimal format, so all we need to do is use the following code:

@Transform (valueList; “x”; @If (x>1; x/100; x) )

This translates into: for each value in “valueList”, which we will call “x”, if that value is greater than 1, then divide it by 100, otherwise, leave it as is.

Another example is my running log. Say we would like to transform all the values in a list of running times from minutes to seconds. But again, we are concerned that some users may have already entered the data in seconds. TRANSFORM! (Picture me like Harry Potter with my wand when you read that).

@Transform (valueList; “x”; @If (x<60; x*60; x) )

This formula assumes that if the user entered a value greater than 60 then they must have entered the value in seconds, not minutes.

As with many @Functions, you are only limited by your imagination and creativity in coming up with ways to utilize the formula. Any formula can be used as the third parameter in @Transform, including @Nothing:

@Transform (valueList; “x”; @If (x<60; x*60; @Nothing) )

Similar to the previous examples, but returns nothing for a value if the value does not meet the criteria, effectively removing the value from the list.

Happy Transforming!