Pages

Wednesday, April 28, 2010

Forall equivalent in Formula Language - @Transform

I felt amazed when I found the Forall (lotusscript) equivalent in Formula Language.

The command is @Transform. It has a typical syntax that it is difficult for beginners to understand.

The syntax for the command is as follows,

@Transform( list ; variableName ; formula )

The parameter named variableName is the culprit that works in a tricky way. In addition the name of the command itself is no where similar to Forall and hence is used less due to lack of a meaningful name, I suppose.

The following is a little illustration of how to use the function.Assume that the following code is in a button (ofcourse you can copy this into a button),

****************

myList=@Explode("FirstValue,NextValue,LastValue";",");
@Transform ( 
   myList;
   "myListValue";
   @Prompt(1;"";myListValue)
)

****************

This will bring up three prompt with the texts - FirstValue, NextValue and LastValue in each of them respectively.

Here the key is understand how I used the iterator parameter myListValue. First I pass it as a string and there after I use it as if it is a normal variable.

The above mentioned code fragment is equivalent to the following in lotusscript.

****************

dim myList as variant
myList=Split("FirstValue,NextValue,LastValue",",")
Forall  myListValue in myList
   msgbox myListValue
End Forall

****************

Hope this helps :)

No comments:

Post a Comment