Solved

@Dblookup on response docs

Posted on 2012-03-21
4
718 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now