ClearFieldValue

Public Shared Sub ClearFieldValue(ByVal model As UIModel, ByVal fieldIDs As IEnumerable(Of String)

Public Shared Sub ClearFieldValue(ByVal f As UIField, ByVal preserveTranslationTextForNotInContextFields As Boolean)

Public Shared Sub ClearFieldValue(ByVal f As UIField)

ClearFieldValue will clear the values for a field or an enumerable list of fields, such as a string array of field names. For the first parameter, you can pass either the grid row as a UIModel if you wish to clear multiple fields or you can pass a UIField to represent the single field within grid row that you wish cleared. Setting the preserveTranslationTextForNotInContextFields parameter to True will ensure that manually defined translation text is not cleared out. 

In the example below, a field-changed handler is added for the PRIMARYCONTEXTRECORDID form field that represents the food bank. When a bank is selected, the ClearFieldsOnFoodBankContextChange delegate function is called which clears the field values for all the form fields listed by the _FOODBANKTXFIELDS string array. 

Private Shared _FOODBANKTXFIELDS As String() = New String() { _
                    CONSTITUENTID, _
                    FOODBANKTXTYPECODE, _
                    TRANSACTIONDATE, _
                    RECEIPTPRINTED, _
                    FOODITEMS_FIELDID}
 
Private Sub FoodBankTransactionAddBatchHandler_AfterLoad(sender As Object, e As System.EventArgs) Handles Me.AfterLoad
With Me.FieldChangedHandlers
            .Add(PRIMARYCONTEXTRECORDID, AddressOf ClearFieldsOnFoodBankContextChange)
        End With
End Sub
 
Private Sub ClearFieldsOnFoodBankContextChange(ByVal e As FieldEventArgBase)
        Blackbaud.AppFx.BatchUI.BatchEntryHandler.ClearFieldValue(e.Model, _FOODBANKTXFIELDS)
End Sub

Let's say the user has entered a row in the batch including children records such food items in the figure below.

When the PRIMARYCONTEXTRECORDID/ Food bank field value changes, the remaining values for the row are cleared and any default values such as Transaction Type are defaulted.