Thanks SrinivasActually I am trying to use only lookup view for all those parent & child(Response docs) forms.And also using number fields to actually deal with the process but a display field to format the way I want.
No success yet.
Number should always increment, no matter if some are deleted from the middle.
Has anybody thought about what should happen, if documents or responses are deleted?
There is of course @DocNumber, but it is intended to be used in column formulas and window title formulas. It kind of works in computed fields as well, but this additional computation is rather useless, as storing the number in the document provides no additional value: DocNumber is alway calculated dynamically. It should work in computed for display fields or computed text as well.
Apart from how to deal with deletions (doc number will always be calculated to display the actual number in the view) there is another problem. The numbering depends on the view displaying the documents. If another view is designed differently, there may be other and/or additional numbers. Also there is no way to introduce the leading zero.
If you choose to calculate numbers yourself, the first thing you have to know is how changes to the document hierarchy should be handled. You need a definite, detailed, written description of what should be achieved. Your code would depend a great deal on what is to be achieved exactly.
Just to give yo idea. usually what i did was storing parent id inside the child. the id must be unique enough this way child will always linked to teh parent. in term of numbering system you must have 2 sets to keep track. one for the parent and another one is for the child. Do not use the numbering as the id.
Anyway there should be a lot of example in lotus notes template. HAve a look at the discussion type template.