locked
Summing detail records RRS feed

  • Question

  • I've run into a problem that I can't explain.

    I have used the code to sum detail records many times in the past.  However, I have one entity that refuses to even execute the code.  I've placed debug statments in the program but the code never even executes.

    Here it is... (The entity is the Agreement table. The code is in the file agreement.vb*)

    Public Class Agreement

    Private Sub Compute_Total_Compute(ByRef result As String)

                Dim total = 0.0

                For Each d In Me.WORKORDERs

                    If d.TotalHours <> 0 Then

                        total += d.TotalHours

                    End If

                Next

                result = total

                Me.CompletedPerformance = Me.Compute_Total

            End Sub

        End Class

    This is the same code I use for summing details of other entities and it works fine but for this particular entity (The Agreement table) the code never even executes.  I have tried entering a new Agreement and updating and existing Agreement and in no case does the code ever get executed.

    I'm lost.

    Ed

    Monday, May 6, 2013 3:10 PM

Answers

  • Never mind... my own dumb fault.

    Apparently the code for a computed field in an Entity is not executed unless the field is actually used on a screen.  I was attempting to use the computed field to hold the result of a temporary calculation but not actually display it on a screen.     

    • Proposed as answer by VictorPerez Monday, May 6, 2013 10:17 PM
    • Marked as answer by Angie Xu Tuesday, June 4, 2013 3:17 AM
    Monday, May 6, 2013 4:27 PM