Solved

@Dblookup on response docs

Posted on 2012-03-21
4
711 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Oops! Just keeping you on your toes ;-)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

  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…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

771 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

12 Experts available now in Live!

Get 1:1 Help Now