5
votes

I need to call a lotus script function from Lotus Formula.

The function returns a result. I do not just want to run a script which does not return any value.

This is for Lotus Notes 7.

Example

LotusScript Functions:

Function isName( name As String) as Boolean  
     if name Is "Danny" Then  
        isName = true  
     endif  
     isName = false  
 End function  

LotusFormula

name := getName("troy")???????

therefore I can then use the name in lotus formula.

Is this possible?

4

4 Answers

8
votes

No. The best you can do from Formula Language is to call a LotusScript agent using either the ToolsRunMacro or RunAgent @Commands, exchanging values through document fields or environment variables.

1
votes

There is no way to call and return a value in LotusScript from the formula language. However, you can go the other way with the LotusScript Evaluate method. Perhaps you can redesign your logic to be based in LotusScript primarily.

1
votes

You can run formula from within LotusScript, but not the other way around, unless you use an agent as Stan has eluded to.

After a few weary years of dev, I generally consider writing lotusScript for most of my work, the exceptions are only if I can write the formula in less than 10 lines and it's unlikely to interact with other documents or update them.

As soon as you need to interrogate many fields in other documents or update them, write them in script. The particular function you have listed in your question would also work as formula, but if your desire is to modularise it in script, then you should consider using script, in those situations exclusively, in place of formula. I would say Formula is merely a short cut for doing basic operations.

0
votes

Use Environment variable - Set name through Formula Environment variable and use the script to access the environment variable and execute your code.