• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

formula script equivalent

What would be the script equivalent of this formula?

@Text(@DbLookup("Notes":"Nocache" ; "Servername":"database.nsf"; "SOLV" ; batch ; 2 ));
@If( @IsError(so); "na"; so);
0
schmad01
Asked:
schmad01
  • 5
  • 3
  • 3
  • +2
1 Solution
 
schmad01Author Commented:
And, will I be able to tag it on to the end of an existing script?
0
 
HappyFunBallCommented:
Dim s as New NotesSession
Dim db as NotesDatabase
Dim view as NotesView
Dim doc as NotesDocument
Dim key(0) as String

Set db = s.CurrentDatabase
Set view = db.GetView("SOLV")
key(0) = batch
Set doc = view.GetDocumentByKey(key, True)
If doc Is Nothing Then
  Messagebox "na"
Else
  Messagebox so
End If

I'm not sure of the context of this code, so you may want to change the messageboxes into return values of a function or to set some fields on a form, etc.

0
 
mbonaciCommented:
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
HappyFunBallCommented:
No reason you can't tag it on the end of a script.  But like I said above, you'll need to add more code depending on what that @formula was returning to.  If that @formula was in a form field, then you'll need to add some code to set that field via the script.
0
 
Sjef BosmanGroupware ConsultantCommented:
I think the eaxct equivalent would be
    ""

I assume your Formula is not correct, semantically...
0
 
HappyFunBallCommented:
nice catch sjef, I've seen @formulas like that so much I assumed the dblookup was being set to a variable.  

I'm basing my response on the assumption this was the intended code:

so := @Text(@DbLookup("Notes":"Nocache" ; "Servername":"database.nsf"; "SOLV" ; batch ; 2 ));
@If( @IsError(so); "na"; so);
0
 
schmad01Author Commented:
:)  It works, I have it in a computed field, computed when composed. I just wanted to put it at the end of another script.
0
 
mbonaciCommented:
schmad01,
Notice "OR" in the definition from designer's help:

@DbLookup( class : cache ; server : database ; view ; key ; fieldName ; keywords ) or
@DbLookup( class : cache ; server : database ; view ; key ; columnNumber ; keywords)


Marko
0
 
HappyFunBallCommented:
Unless I'm missing something, schmad01's formula fits the first type of @DBLookup.  What were you getting at Marko?
0
 
mbonaciCommented:
It works by accident :)
It has an error, he has put fieldName and columnNumber in it, he merged two versions of formula.

The lucky part (but I would rather say it's unlucky) was that Lotus thought number 2 is keyword so he just ignored it.


Keywords are:
[FAILSILENT] [PARTIALMATCH] [RETURNDOCUMENTUNIQUEID]


Marko
0
 
HappyFunBallCommented:
"keywords" are optional, right?  If so, check the number of parameters again.  The formula looks right to me.
0
 
Steve KnightIT ConsultancyCommented:
Of course if you are really lazy....

dim batch as string
batch = doc.batch(0) or whatever
Evaluate | @Text(@DbLookup("Notes":"Nocache" ; "Servername":"database.nsf"; "SOLV" ; | & batch & | ));  |

Steve
0
 
Steve KnightIT ConsultancyCommented:
(an obviously doing something with the result of evaluate.... i.e.  result=evaluate |  sdsdjksjskd  |
0
 
schmad01Author Commented:
Thanks alot.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now