?
Solved

@Dblookup on response docs

Posted on 2012-03-21
4
Medium Priority
?
772 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 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
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.
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

864 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