By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
1. Create a table with four columns and four rows. Put a field in each cell and name the fields A,B,C,D.
2. Create a table with four columns and one row. Copy and paste the fields in the top table into the table. The first row starts with A_1 and the last row with A_4. The next column is B_1...etc. This one only works when you make a copy of the row in the top table. Otherwise, the names of the fields are A_1_1, B_2_2 and that will not work.
2a. Now you can hide the top table. However, do not remove the table. It is very useful if you want to change the properties for a field. You can do it in one place then copy and paste again.
3. Create an agent and paste the code into it. Then save the agent manually from the action menu and run once.
4. Create an action. Name it and from simple action, choose run agent.
You can not calc values in a very simple way in a grid. Write the values in the first three columns and run the agent by pressing the action button.
'Global declaration Dim ColumnCounter(1 To 4) As String Dim Uidoc as notesuidocument Sub Initialize Dim workspace As New notesuiworkspace Dim i As Integer Set uidoc = workspace.currentdocument Call setColumnNames For i = 1 To 4 Call setAndCalcFields(i) Next i End Sub Sub SetColumnNames() ColumnCounter(1) = "A" ColumnCounter(2) = "B" ColumnCounter(3) = "C" ColumnCounter(4) = "D" End Sub Sub setAndCalcFields(row As Integer) Dim x As Integer Dim FieldName As String Dim sum As Double On Error Resume Next For x = 1 To 3 fieldName = ColumnCounter(x) + "_" +Trim(Str(row)) sum = sum + Cdbl(uidoc.FieldGetText(FieldName)) Next x fieldName = ColumnCounter(4) + "_" +Trim(Str(row)) Call uidoc.FieldSetText(fieldName, Str(sum)) End Sub