Dblookup evaluate limitation?

Hi,

It seems that there is a limitation concerning the evaluate function with @dblookup. When the field or value specified as key contains more than one value, it doesn’t work.

Here is my (very simple) code :

Dim formula As String

formula={@DbLookup(“”:“nocache”; “”; “gdbkprojet”;Projet; 2)}

eval = Evaluate(formula, doc)

When “Projet” item contain more than one value the evaluate function return nothing…

When “Projet” item contain one value the evaluate function return data expected.

Could someone explain me why ?

Thanks in advance

Julien

Subject: You got to revisit the formula spec…

Hi Julien,

According to spec:

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

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

“key” is a singular description - a key is always a single value. Hence your “Projet” (which is a key) must be a single item. When it is multi-value, Evaluate will return nothing.

Cheers,

Teck-Lung

Subject: RE: You got to revisit the formula spec…

Thanks to take time to answer me :slight_smile:

You can have multiple values in dblookup Key. It’s very usefull. I use it a lot in my devlopments.

exemple :

@DbLookup( “” : “NoCache” ; “Server” : “Database” ; “Fruit” ; “apple”:“orange”:“banana” ; 2)

Thanks again.

Subject: dblookup evaluate limitation ??

Try creating a string to represent the array of values in the Projet item. Something like

dim item as notesitem

dim formula As String

dim i as integer, n as integer

set item = doc.getfirstitem(“Projet”)

n = ubound(item.values)

project =“”“”+item.values(0)+“”“”

for i = 1 to n

project = project+“:”“”+item.values(i)+“”“”

next i

formula={@DbLookup(“”:“nocache”; “”; “gdbkprojet”;Projet; 2)}

eval = Evaluate(formula, doc)

I’m not sure just where all the quotes would go becuase I don’t use the brackets as you do, but you get the idea.

Subject: dblookup evaluate limitation ??

I have no problems using multiple keywords in @DBLookup Evaluate.Not sure though what would happen if one of the keywords resulted in error(keyword not found in view).

Subject: RE: dblookup evaluate limitation ??

Thanks !!!

I had an error with one of my key value !

Really thanks !

Subject: dblookup evaluate limitation ??

Check your formula and put Projet within quotes as “Projet”