LotusScript Evaluate and @DbLookup

3845 pts.
Tags:
Lotus Domino
I've run into a snag with the lotsscript Evaluate statement. It seems like I used to be pretty good at this but I can't quite understand where I am going wrong now. I want to use @dblookup to do a lookup. I should be able to give it the document context and get a returned value. I can't seem to make it work, so I tried to simplify it more by passing in the lookup key, rather than using the form field name. This is the script. FormulaTemp$ = {@DbLookup("Notes":"NoCache"; "": ""; "Single Lookup View"; "} & result.emplid(0) & {"; 2)} EvalResult = Evaluate(FormulaTemp$) It takes an employeeID and checks the Single Lookup View, returning the second column's value (this second column's value is the mother load, a tilde-separated string of about 25 values that is only calculated in the view, not on the document). I have run the script through debug and trapped the FormulaTemp$ value (below). To test it, I took out the double quotes and leading and trailing qoutes, put it in a text field on a document in the database and hit Shift + F9 -- I get the tilde-separated value I need. In the lotusscript, I get blank. Because there is no longer a document context, I have tried to do this with and without the doc object (shown above). It doesn't work either way. (result is another document object with a field called Emplid.) "@DbLookup(""Notes"":""NoCache""; """": """"; ""Single Lookup View""; ""00000662724""; 2)" This is a version of the statement I have tried with the document object, although I think it is not needed. [same first line] EvalResult = Evaluate(FormulaTemp$, doc) This is a version that references a document field, thus needing the document object. This doesn't work either. FormulaTemp$ = {@DbLookup("Notes":"NoCache"; "": ""; "Single Lookup View"; AUContact_Emplid; 2)} EvalResult = Evaluate(FormulaTemp$, doc) I've referenced this developer works page and can't find where I am going wrong. http://www-128.ibm.com/developerworks/lotus/library/ls-The_Evaluate_statement/index.html#author

Answer Wiki

Thanks. We'll let you know when a new response is added.

What type of variable is EvalResult defined as? Have you tried using the escape character in front of the embedded quotes? You say it doesn’t work, but don’t say what happens. Error message?

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Dpeabo
    In the Designer help file, there is a "Using the Evaluate statement" document. In there it mentions that if the formula in the Evaluate statement is using a field on the document, then that document object must be included in the Evaluate statement. I saw that you are calling the column number in your @DbLookup, but I would guess the Evaluate statement doesn't have enought granularity to determine if you're return value is to be a column value or a field value.
    0 pointsBadges:
    report
  • CharlesJC
    Brooklynegg, Change the data type of FormulaTemp to be a Variant. The Evaluate function will return an array containing the values. So, if there are one or more values returned, the first value is in FormulaTemp(0). The following code should work for you: 'Start Dim FormulaTemp as Variant Dim EvalResult as string FormulaTemp = Evaluate("@DbLookup(""Notes"":""NoCache""; """": """"; ""Single Lookup View""; ""00000662724""; 2)") EvalResult = FormulaTemp(0) 'End Charles
    0 pointsBadges:
    report
  • Deadleaves
    Hey Brooklynegg, An alternative might be to dispense with Formula language altogether. I haven't tried this myself but you could try the GetEntrybyKey method of NotesView class. Then use the ColumnValues property of the NotesViewEntry class. I'll have a crack at the code here but this would need some testing ... Dim session As New NotesSession Dim db As NotesDatabase Dim view As NotesView Dim ve As NotesViewEntry Dim key as String Dim EvalResult as Variant Set db = session.CurrentDatabase Set view = db.GetView("Single Lookup View") key = result.emplid(0) Set ve = view.GetEntryByKey(key) EvalResult = ve.ColumnValues(1) ColumnValues returns a zero-based array, hence element 1 above should equate to the 2nd column. Hope this helps.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following