Inheriting values in a response document field from parent document

Hello experts,

I am fairly new to notes and in the process of creating my first application.
I have created 2 forms one is a reponse document and the other one is a parent.
I have linked them having a field in the parent form called "MainID" which is a computed
value with the formula "@Text(@DocumentUniqueID)". In the response document
I have a field also called "MainID" its value is MainID. The problem I'm having is
inherting values from the parent form. Theres a field in the parent document called "name"
in the response document I want a field to have the value "the version of" + name.
Some how I can't seem to get it to work.

Please HELP!!
LVL 5
apparitionAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

p_parthaCommented:

Just create a field in the response document with it's default value like this:

"the version of " + name

Partha
0
apparitionAuthor Commented:
Tried that already, for some reason its not working.
0
CRAKCommented:
The response already has a field "$Ref". It holds the parent's doc id. You could use it to your benefit instead of MainID.
Be careful using computed fields to store the parents doc id. When editing the document, it will compute its own doc id! Use computed when composed instead!

The same goes for the response doc's name field. However, if the parents name changes, you want to be able to update the responses name by -worst case- a simple edit. Computed when composed isn't suitable.
Use computed for display instead (if you don't need the computed name on the response to be shown in a view) or computed:
"the version of " + @GetDocField($Ref; "Name")

This might cause undisired side effects on newly created doc's. To overcome that, use this one:

"the version of " +
@If(
   @IsNewDoc;
   Name;
   @GetDocField($Ref; "Name")

Don't forget to switch on the form's property to inherit fields values!
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

apparitionAuthor Commented:
>>The response already has a field "$Ref". It holds the parent's doc id. You could use it to your benefit instead of MainID.

Please explain how the $Ref can be used to link the 2 documents.
0
apparitionAuthor Commented:
I tried using "the version of " +
@If(
   @IsNewDoc;
   Name;
   @GetDocField($Ref; "Name")

the field only displays "the version of"

Trying,
the version of " + @GetDocField($Ref; "Name")

gives me an error "Field 'Name': Invalid UNID; UNID must be a 32-digit hex string."
0
ArunkumarCommented:
Whenver you create a response document lotus notes creates an internal field $Ref to establish the main - response relationship.

This field will contain the document unique id of the main document.  So, whenever you want to get a parent or main document from a response document you can use this internal field $Ref.

As a simple task you can create a view with first column as doc id.

Have this formula
@If(@IsAvailable("$Ref") ; @Text($Ref) ; @Text(@DocumentUniqueID));

uncheck the option : show responses in hierarchy option in view.

now you will see main and response documents having same ID in the views first column.  This is just an example to show you how they share the same DocID but in different contexts.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CRAKCommented:
In a view like Arun describes, just to get an impression, following modification of the column formula might help you just a bit more:
@If(@IsAvailable("$Ref") ; @Text($Ref) + "-Response" ; @Text(@DocumentUniqueID) + "-Parent");

Based of the error, we need to convert $Ref to a string:
"the version of " +
@If(
   @IsNewDoc;
   Name;
   @GetDocField(@Text($Ref); "Name")

If you want to use $Ref for more cross document linking (using @DocumentUniqueID, @GetDocField, @DbLookup, @DbColumn or Lotusscript) please keep following in mind:
Every document has a DocumentUniqueID. Only responses have a $Ref field. $Ref holds the parent's document id (if you copy paste a response to another parent, you will even see $Ref change!).
If, from a parent, you are looking for its response documents, collect the documents that have the parents docid in $Ref. If, from a response, you need the parent document, simply get the one that $Ref refers to.

Now because of $Ref changing after copy/paste to another parent, many developpers use a field like your MainID, to keep it connected to its original parent. When MainId and $Ref hold a different docid, you know that you need to restore the original link..... But that's a more advanced issue. Lets get this version field on track first!
0
ArunkumarCommented:
And i am done for 25 pts !!!
0
apparitionAuthor Commented:
tried...
"the version of " +
@If(
   @IsNewDoc;
   Name;
   @GetDocField(@Text($Ref); "Name")
still doesn't work

and also tried just @GetDocField(@Text($Ref); "Name")
gives me the same error message.
0
CRAKCommented:
I've been away for a couple of hours. I noticed your comment above and that you awarded points.
I assume things happened in that order.
What was the final touch that made it work? Did we forget anything?
0
apparitionAuthor Commented:
Its still not working...I realised that it still isn't working after awarding the points.
0
CRAKCommented:
Perhaps it's easier if we take a look ourselves. Can you please mail the template to notes.domino@zonnet.nl?
0
apparitionAuthor Commented:
Is there  a link to a sample DB you guys can provide? Where response doucuments have been used.
0
CRAKCommented:
Notes holds a set of standard templates. Create a new database, based on the template "Discussion".
The standard templates aren't always the easiers to start off with. Let me know if you need an easier one.
0
apparitionAuthor Commented:
the discussion template looks to complicated to start off with. Are there any simpler ones. I just need a very basic one with response documents.
0
CRAKCommented:
Can I have your mail address to send you something simple?
If you don't want it displayed online, please mail me at notes.domino@zonnet.nl
0
apparitionAuthor Commented:
my mail address is malik.arefin@rogers.com
0
CRAKCommented:
Its on its way!
0
apparitionAuthor Commented:
Ah finally it works.....I realise what the problem was. In my response form
properties "Formulas inherit values from selected document" wasn't checked.
0
CRAKCommented:
Often that is the problem.... and I told you before. Perhaps I should have mentioned the excact phrase.
Anyway, glad we got that out of our way!

Arun, you appear to have lost interest after "cashing the cheque"..... Where are you? Why do you leave all the "hard word" to me?

;-))
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.