Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

@Dblookup on response docs

Posted on 2012-03-21
4
727 Views
Last Modified: 2013-12-18
Hi,

I have a computed (for display) field on a parent document that I want to populate with a list of names stored in fields inside response documents.

I've had some success with this, i.e. showing responses to the main document in an embedded view on the parent document. However I'm not having much luck with the computed field, possibly the way I've built my view to display the list of names, or my @dblookup syntax/Key/$Ref etc.

If someone could give me a step by step on how to do this, i.e. build the view correctly, and then implement the formula on the computed field that would be great. Please no LS solutions as I really don't have much understanding of it.

The field containing the name on the response document is called "DocFormRespResponsibility" it will only contain a single name, however there may be several responses per parent with the same username, but I only wish to display them once (I will later use this for mailing response doc authors)

Thanks :)
0
Comment
Question by:scribla
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
Sam654 earned 500 total points
ID: 37750412
Okay, so the parent document doesn't contain any reference to its child documents. That's just the way it is.

So you need to create a view and have the first column sorted by $Ref (you might want to use @Text( $Ref ) as your formula for the column, $Ref contains the UNID of it's parent document, have your "DocFormRespResponsibility" as the second field. Oh and you might want to hide the view so users can't see it.

You then need to get your computed for display field to do a DbLookup using it's own UNID as the key (which will correspond with the $Ref of its children) and return the second column. Enclose the DbLookup in @Unique to remove duplicates. Should look something like this.

Add error checking to return blank "" if nothing is found, otherwise "entry not found in index" will appear in the field.

Lookup := @DbLookup( "Notes" : "NoCache" ; "" : "" ; "<MyViewName>" ; @Text( @DocumentUniqueId ) ; 2 ) ;
@Unique( @If( IsError( Lookup ) ; "" ; Lookup ) )

I'm assuming that your "DocFormRespResponsibility" isn't computed for display, it shouldn't be if it contains usernames.

If that doesn't work, change the blank "" in the last line to debug, get it to show you each element of the @DbLookup so that you can verify what you think should in the lookup... is!

@Unique( @If( IsError( Lookup ) ; @Text( @DocumenUniqueID) ; Lookup ) )

Report back how you get on.
0
 
LVL 7

Expert Comment

by:Sam654
ID: 37750424
Or you could make the field on your parent document "computed" and trigged the following code on save or when the "DocFormRespResponsibility" is set using the following.

ExistingValues := @GetDocField( $Ref ; "<ParentDocFieldName>" ) ;
@SetDocField( $Ref ; "<ParentDocFieldName>" ; @Unique( ExistingValues : DocFormRespResponsibility ) )

BUT I WOULD STRONGLY SUGGEST NOT DOING THIS AS IT IS LIKELY TO RESULT IN REPLICATION SAVE CONFLICTS and could be prone to other updating problems if response documents are deleted etc.
0
 
LVL 2

Author Comment

by:scribla
ID: 37752386
Works great, however anyone who finds this solution from a search, the is an @ missing on IsError in the above example.

The following works fine:

Lookup := @DbLookup( "Notes" : "NoCache" ; "" : "" ; "<MyViewName>" ; @Text( @DocumentUniqueId ) ; 2 ) ;
@Unique( @If(@IsError( Lookup ) ; "" ; Lookup ) )

Many thanks! :)
0
 
LVL 7

Expert Comment

by:Sam654
ID: 37755032
Oops! Just keeping you on your toes ;-)
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question