Solved

Inheriting values in a response document field from parent document

Posted on 2003-10-30
20
905 Views
Last Modified: 2013-12-18
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!!
0
Comment
Question by:apparition
  • 9
  • 8
  • 2
  • +1
20 Comments
 
LVL 14

Expert Comment

by:p_partha
ID: 9652519

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

"the version of " + name

Partha
0
 
LVL 5

Author Comment

by:apparition
ID: 9652663
Tried that already, for some reason its not working.
0
 
LVL 13

Expert Comment

by:CRAK
ID: 9652858
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
 
LVL 5

Author Comment

by:apparition
ID: 9653547
>>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
 
LVL 5

Author Comment

by:apparition
ID: 9653785
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
 
LVL 9

Accepted Solution

by:
Arunkumar earned 25 total points
ID: 9653814
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
 
LVL 13

Assisted Solution

by:CRAK
CRAK earned 25 total points
ID: 9656060
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
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9657432
And i am done for 25 pts !!!
0
 
LVL 5

Author Comment

by:apparition
ID: 9657930
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
 
LVL 13

Expert Comment

by:CRAK
ID: 9660546
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 5

Author Comment

by:apparition
ID: 9672006
Its still not working...I realised that it still isn't working after awarding the points.
0
 
LVL 13

Expert Comment

by:CRAK
ID: 9676783
Perhaps it's easier if we take a look ourselves. Can you please mail the template to notes.domino@zonnet.nl?
0
 
LVL 5

Author Comment

by:apparition
ID: 9679690
Is there  a link to a sample DB you guys can provide? Where response doucuments have been used.
0
 
LVL 13

Expert Comment

by:CRAK
ID: 9682320
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
 
LVL 5

Author Comment

by:apparition
ID: 9682358
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
 
LVL 13

Expert Comment

by:CRAK
ID: 9685344
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
 
LVL 5

Author Comment

by:apparition
ID: 9686498
my mail address is malik.arefin@rogers.com
0
 
LVL 13

Expert Comment

by:CRAK
ID: 9686652
Its on its way!
0
 
LVL 5

Author Comment

by:apparition
ID: 9688828
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
 
LVL 13

Expert Comment

by:CRAK
ID: 9689823
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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

10 Experts available now in Live!

Get 1:1 Help Now