[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

@Dblookup on response docs

Posted on 2012-03-21
4
Medium Priority
?
760 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
[X]
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
  • 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 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