Hi
I have a database that has two forms per each person. Each form contains a field I need for a calculation. I need to find the difference between the two fields. Does anyone know how I can do this easily? Is there a way to do it in the view?
Thanks in advance!
Subject: Calculation
Also, why do you need to find the difference? Is this a report? Is it to be stored in one of the forms? If you’re doing a report via an agent, what does the rest of the agent look like? What language are you writing it in?
Is this something run via a button? How are you doing it? What is it’s purpose? What code do you have so far?
Presumably, you want to get all documents in a view by the person name (if there are indeed 2 documents and you can set the view selection to get only those two documents for each person). The view would be sorted by the person’s name that you are using. Then create the report… i’ll use ls for an example
Now, since we know that every two names go together (if this is true that there will be two documents for each person), use loop through the view and perform your calculation (the field you want to compare) in groups of two (using modulus).
If there are will not always be two documents, then create an array of person’s names, then loop through the view and create a document collection with NotesView.GetDocumentByKey(person’s name)
and then loop through tht collection doing your calculation and write your result to wherever you need to. Once you’re done with each person’s name continue looping through the array.
Subject: Calculation
Do you mean two documents or two forms?
Do you mean that you want to subtract Field2 from Field1? Then I’d use Field1 - Field2 for the calculation.
regards,
raphael