Here’s what I’m looking for:DocA has button (call Parts) that does a picklist to a view called Parts.
The user selects DocB from the list. Information is then pulled from DocB to DocA.
The user then enters a quantity used on DocA.
What I need to do is have the quantity field value of DocA to go back to DocB (Field: QuantityUsed) and
update DocB to subtract the amount (from DocA) to give a new total on DocB.
DocB has 3 fields Quantity Purchased - Quantity Used = Total Quantity.
Help with an example in LotusScript would be appreciated. Thanks.
Subject: Transfer values between two docs
RJ, typically contributors here will help you with a specific problem you’re having with your code or your approach. You’re basically asking someone to write your code for you here, though. Seems kind of strange. What you’re trying to do should be a pretty straight forward process using LotusScript. The Domino Designer Help has all sorts of examples of how to copy item (field) data from one document to another. Is there a specific part of the code that you’re having trouble understanding?
Subject: Transfer values between two docs
When the person chooses the part from your list, you’ll have to keep the noteid of DocB in a hidden field of your DocA to be able to update the fields in DocB once the quantity that was used is updated in DocA. To do that, you could put some code in the querysave of DocA. I included some code you could put in the querysave of DocA to help get you started but it’s very simplistic and doesn’t make any verifications if the quantity used isn’t higher than the quantity available. You’ll have to add some validations to make sure you don’t get negative numbers, in turn falsely representing the inventory. You could put that code in the Input Validation event of field where the people enter the quantity they used.
Dim session As New NotesSession
Dim uiWorkspace As New NotesUIWorkspace
Dim uiDoc As NotesUIDocument
Dim partsDoc As NotesDocument
Set uiDoc = uiWorkspace.CurrentDocument
Set partsDoc = session.CurrentDatabase.GetDocumentByID(uiDoc.Document.partNotesID(0))
Call partsDoc.ReplaceItemValue("QuantityUsed", uiDoc.Document.AmountUsed(0))
Call partsDoc.ReplaceItemValue("TotalQuantity", partsDoc.QuantityPurchased(0) - partsDoc.QuantityUsed(0))
partsDoc.Save True,True
Subject: RE: Transfer values between two docs
Great! Thank you for the response and getting me on the right track. Still pretty “rusty” here with LotusScript. (Mostly an @function programmer).
Subject: RE: Transfer values between two docs
Follow Up:
Thanks David … I got the database working great!! I appreciate the help and sample code.