Advertisement

11.20.2008 at 12:25PM PST, ID: 23922983
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

How do you get a collection of all the consultant name values of the Parent's children and write the multi-value name list to the parent. Can it update on parent & child save?

Asked by KTTKTT in Scripting Languages, Databases Miscellaneous, Data Manipulation

Tags: , , , , ,

12/01/08 re-phrasing question to see if I can get a response:
The objective is to be able to categorize 1st column view by multivalue consultant name using all consultant child doc names and display parent request id in a hierarchy in the next column.  To accomplish this, I need to have all the child consultant names written back to the parent Request.
Users use a button with embedded assignment view, on the parent Request form to create a child assignment form which houses the consultant name, so the parent request is still open while the assignment form is created.  The Assignment form's consultant name has to be written back to the Parent request as a multi-value collection to include all child doc consultant names on save without creating save conflicts with the parent.  
Should an agent run after parent doc is saved and closed?
-------------------
Background Info - previously entered:
I have an Assignment Child Form with the Consultant name as a multivalue field that updates the Consultant field in the Parent Request Form.
Input translation for Consultant is as follows in the Assignment Child form:
@If(@IsNewDoc; @Trim(@Unique(Consultant))  ;
@IsDocBeingSaved;  @SetDocField($Ref ; "Consultant";  Consultant );   Consultant)
Each time the Assignment form is saved, the Consultant multi-value names are written to the parent Consultant field successfully.
I need to be able to retain all Consultant names from all Consultant Assignment docs, so that the view displays multi-value entries as separate values.  
Originally, If an additional assignment form was created and saved, it wrote over the Old Parent Consultant field name with the new name, so I created another Parent Request compute Field called Consultant_Dsp to retain all old and new names.
Here is the computed formula for the Parent Consultant field to generate a list of old and new fields in Consultant_Dsp:
@IsDocBeingSaved; @Trim(@Unique(@Name([CN] ; Consultant) ));  Consultant ;
FIELD Consultant_Dsp := @Trim(@Unique(Consultant_Dsp  : Consultant )) )

Here is the computed formula for the Parent Consultant_Dsp field:
@If(@IsDocBeingRecalculated ; @Unique(@Trim(Consultant_Dsp : Consultant )) ; Consultant_Dsp )

This all works as long as you go back and Edit/Save the Parent request to get that last Consultant entry that was last created from the Assignment form save.
Here is an example of the field values in Parent doc:
Consultant: NameD
Consultant_Dsp:  NameA, NameB, NameC
I need the Consultant_Dsp field to update & refresh immediately after Consultant is updates, so that it adds NameD wihout having to create another Assignment form which refreshes the Consultant_Dsp field to finally display:
Consultant_Dsp:  NameA, NameB, NameC, NameD
Need the Consultant_Dsp to update immediately after Consultant updates without having to open parent request, place in edit mode and save.

I added this script to the qsave in the child Assignment form, but I get the same results.
Can you help me with this script to update the Consultant_Dsp field after the Consultant field is updated : how do I do that - not good at LotusScript:
On query save, I do the following to update the parent doc:
Dim parent As NotesDocument
Dim parentUnid As String
Dim view As NotesView
Set doc = Source.document
If doc.HasItem( "$Ref" ) Then
Set parent = db.GetDocumentByUNID( doc.ParentDocumentUNID )
                                           parent.CTConsultant = CTConsultant
            Call parent.ComputeWithForm(True,False)
            Call parent.Save( False, False)
      End If
--------------------------------
Also does someone have a working LotusScript Agent I can use that will Update the existing Parent/child docs with the Consultant and Consultant_Dsp fields - these are new fields so I have to refresh the existing records.  I'm having to Refresh the child doc from the view using a refresh agent"
(@Command([ToolsRefreshSelectedDocs]); @Command([ViewRefreshFields]) ; @All
which successfully updates the Consultant field, but then I have to Refresh the Parent doc so that it updates the Consultant_Dsp field, then go back to the 2nd child doc to refresh, then back to the parent to refresh Consultant_Dsp.   It would be nice if I could select ALL Child Assignments and click Refresh from Actions menu that will update Consultant_Dsp each time it updates Consultant sequentially.
I'm afraid that if I run a background agent to do this, I can't see what it's doing or not doing, so at the moment, I need to see how the docs behave after a refresh by selecting a group at a time.
Thanks in Advance for your help !

11/21/08 4:00 p.m.: ok situation is getting worse here - really need someone's help please.
Getting replication save conflicts using the approach above - the user creates a child Assignment doc within the Parent doc while in Edit mode - the Child Assignment view is embedded in the Parent Request and the users use a Create Assignment button within the Open Parent form, so of course a save conflict occurs when writing the Consultant field to parent Consultant field.   In cases where the Parent form is just in Browse mode and the user creates an Assignment, no replication save conflict occurs, but the consultant field is not saved back to the Parent request.  Thanks again in advance for some insight and a solution.

11/21/08 10:00 p.m.:  maybe an agent to run on save to build the consultant collection after the parent form is saved and closed?  Start Free Trial
[+][-]11.21.2008 at 06:23AM PST, ID: 23013025

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.22.2008 at 06:01AM PST, ID: 23226416

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Scripting Languages, Databases Miscellaneous, Data Manipulation
Tags: LotusScript, Formula, Update Parent, Child, Refresh, Computed Fields
Sign Up Now!
Solution Provided By: KTTKTT
Participating Experts: 0
Solution Grade: A
 
 
 
Loading Advertisement...
20081119-EE-VQP-49 - Hierarchy / EE_QW_EXPERT_20070906