[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

Accessing Information from a different NSF

Hi Experts,

   I am trying to build a form in NSF A which contains a field name Vendor.  I pick the Vendor out of the Vendor NSF (Address book).  When I get the name of the Vendor, I used  @Dblookup with the [ReturnDocumentUniqueID] option.  I was thinking to use @GetDocField to get the Vendor's address, contact person, etc, but then I found out that @GetDocField only works for the current Database.  

So, is there a way to get the field values of a particular vendor?  
Do I need to build a view with the needed field values in the Vendor NSF?

thanks,
andy
0
damrakandy
Asked:
damrakandy
  • 4
  • 2
  • 2
  • +2
1 Solution
 
lamdalamCommented:
Hi,

Yupe. You may create a view and put all the needed fields in on the view.
You can use Dblookup to  get all specified column in the view.
Here you get the values and you can manipulate it.

I havent test out thie approach yet, but I think you can play around with the retrieved values.  :)

Lamdalam
0
 
Sjef BosmanGroupware ConsultantCommented:
Options:
1) create an additional view in the Vendor db, for multiple consecutive @DbLookup calls:
    vdname:= @DbLookup("":"NoCache"; "vendor.nsf"; "viewname"; column; key; "Name");
    vdaddr:= @DbLookup(""; "vendor.nsf"; "viewname"; column; key; "Addr");
    ...
2) write it in LotusScript; in pseudo-code:
    open the 2nd db
    open the view
    search for the vendor-document based on the key
    get all fields you need
3) is like 1), but faster:
    create the view with one column that contains a formula like
        Name:Addr:...
    Only one @DbLookup is required, to get all the data
        data:= @DbLookup("":"NoCache"; "vendor.nsf"; "viewname"; column; key; column_number);
    To get individual values, use
        name:= data[1];
        addr:= data[2];
        ...
0
 
mbonaciCommented:
sjef_bosman,
I think you made a mistake, these are two versions of @DbLookup:

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

so without your column parameter.

damrakandy,
you don't need Doc's UNID, you allready have the doc looked up - simply specify the fieldName in double quotes.

I also suggest you to include the fields in the lookup view.
That way the formula wont search the whole document till it founds your "fieldName" field, instead it will simply look up the value in the specified column.
If you don't get the value you expect look at designer's help on DbLookup about counting the columns when specifying that param.

Hope this helps,
Marko
0
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!

 
Sjef BosmanGroupware ConsultantCommented:
Correct. It's not my day, I think... :-|
0
 
mbonaciCommented:
sjef,
it happens, you probably wrote about DbLookup and thought about DbColumn :)

For me you're still first :))

Marko
0
 
marilyngCommented:
Hi damrakandy,
In addition to the other posts, in my parsimonious days, I would create the view with the first column being the lookup value, and the second column being the concatenated value of all the fields I need for the lookup.. i.e. name + " |" + address + " |" + city + " |" + state + " |" + zipcode + " |"

Then my @dblookup checks for the first column, returns column2,
theVal:=@dbLookup("":"NoCache";server:db;"view";key;1);
returnval:=@if(@isError(theVal) | theVal="";"something";theVal);


Then you use @Word(theVal;"|";1);@Word(theVal;"|";2), etc. to set the values in your form, or you can @Explode(theVal;"|") and use theVal[0], theVal[1] to access the data.

The value is one lookup, one return value.

But, in this day an age, all above are valid ways to perform the same function.. just depends on how many lookups you have :)

Regards!
0
 
Sjef BosmanGroupware ConsultantCommented:
Option 3a...  ;)
0
 
damrakandyAuthor Commented:
Hi All,

0
 
damrakandyAuthor Commented:
Hi All,

  Thanks for all of your helps!  sjef_bosman will get the points.

andy
0
 
Sjef BosmanGroupware ConsultantCommented:
Thanks :)
0

Featured Post

Independent Software Vendors: 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!

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