开发者

Calling Lotus Script Function From Lotus Formula

开发者 https://www.devze.com 2023-01-30 09:23 出处:网络
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.

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?


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.


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号