DBlookup using multiple key

Hi,

I am trying this simple thing but I am lost somewhere. I don’t know what I am missing. I am trying to do Dblookup to fetch values from the third column in a view based on the first two coulmn values.

I have 3 fields in a form. For the first field, I am doing Dblookup from the first column of the view. For the second field, I am doing Dblookup from the second column of the view based on the values selected in first field.

Now for the 3rd field, I have to get the value from the third column of the view based on the values selected in first 2 fields. In sort, I have to do dblookup based on 2 keys rather than one. I was trying giving values selected in first 2 fields as a key fro 3rd field separated by colon but its not working.

Thanks so much in advance

L TYAGI

Subject: Composite key

This is not a multiple key problem.You need an additional view.

Do a copy/paste of your lookup view.

Say the first colum evaluates to dsp1 and the second to dsp2.

Replace the first 2 columns by only one sorted column with a formula like @Text(dsp1)+“*”+@Text(dsp2). You have now only 2 columns left in your new view named say “myview”.

In your form, the formula of the lookup in your 3rd field should now be:

mykey := @Text(field1)+“*”+@Text(field2);

@DbLookup(“”:“NoCache;”";“myview”;mykey;2)

Hope this helps.

Thierry Cayla

http://dominoeffects.serveblog.net

Subject: Don’t do it

You will see from the designer help that multiple keys are not supported in @formulae for starters.

Second, a lot of Domino devs have given up using anything other than single column lookups. It is common to construct a combined string key that allows a single lookup.

Also avoid looking up non-strings. That can be iffy also. For example non-string lookups fail via local notes Java api but do work using remote Java api. There are other wierd things going on.

Single sorted column with combined strings!

S

Subject: If you can, use LotusScript.

  • NotesDatabase.getDocumentsByKey() supports an array for the key, so you may search for any number of keys without issue. I use that all the time.

  • Hope this helps.