Native epiUltraGrids collection

Old code - could probably be done better
Here is code we use in receipt entry - This adds Due Date column to the grid and populates it with data
'//**************************************************
'// Custom VB.NET code for ReceiptEntryForm
'// Created: 6/7/2006 10:16:46 AM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Text
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO

Module Script

'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **
Private WithEvents edvPendingRcvDtl As EpiDataView
Private DidThat As Boolean
Private WithEvents oTrans_receiptAdapter As EpiBaseAdapter
'// End Wizard Added Module Level Variables **

'// Add Custom Module Level Variables Here **

Sub InitializeCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls
DidThat = False
'// Check dataview for DueDate column and add if not there
edvPendingRcvDtl = CType(oTrans.EpiDataViews("PendingRcvDtl"), EpiDataView)
If Not (edvPendingRcvDtl.dataView.Table.Columns.Contains("DueDate"))
edvPendingRcvDtl.dataView.Table.Columns.Add(new DataColumn("DueDate"))
End If
'// End Custom Method Calls
End Sub

Sub DestroyCustomCode()

'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal
oTrans_receiptAdapter = Nothing
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
'// End Custom Code Disposal
End Sub
'// When Pending Receipts dataview is initialized and has data and we have not looked up due dates, then look up dates and set flag indicating lookup
Private Sub edvPendingRcvDtl_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvPendingRcvDtl.EpiViewNotification
If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
If (args.Row > -1) And (DidThat = False) Then
AddDueDate()
DidThat = True
End If
'// When Pending Receipts dataview has no rows, make sure we set DueDate lookup flag to false
If (args.Row = -1) Then
DidThat = False
End If
End If

End Sub
Private Sub AddDueDate()
'//Add Due dates for the Release
If Not (edvPendingRcvDtl.dataView.Table.Columns.Contains("DueDate"))
edvPendingRcvDtl.dataView.Table.Columns.Add(new DataColumn("DueDate"))
End If
'//Loop through every row in the grid and Add the Due Date into the Row
For Each dr As DataRow in edvPendingRcvDtl.dataView.Table.Rows
If IsDBNull(dr("DueDate")) Then
dr("DueDate") = getDueDate(dr("PONum"),dr("POLine"),dr("PORel"))
End If
Next
End Sub
'// Takes PONum, POLine, PORel and looks up PO info and returns the Due Date Value
Private Function getDueDate(ByVal po as Integer, ByVal line as Integer, ByVal rel as Integer ) As String
Dim dueDate As String
Dim recordSelectedRel As Boolean
Dim showSearch As Boolean = False
Dim whereClauseRel As String = "PONum = '" & po & "' And POLine = '" & line & "' And PORelNum = '" & rel & "'"
Dim dsRelease As DataSet = SearchFunctions.listLookup(ReceiptEntryForm, "PORelSearchAdapter", recordSelectedRel, showSearch, whereClauseRel)
If (recordSelectedRel = True) Then
dueDate = dsRelease.Tables(0).Rows(0)("DueDate").ToShortDateString()
End If
Return dueDate

End Function

Private Sub oTrans_receiptAdapter_AfterAdapterMethod(ByVal sender As object, ByVal args As AfterAdapterMethodArgs) Handles oTrans_receiptAdapter.AfterAdapterMethod
'// Reset the DidThat variable on update so we can look up due dates again

Select Case args.MethodName

Case "Update"
DidThat = False
Case Else

End Select

End Sub


End Module


--- In vantage@yahoogroups.com, "cooner_55421" <cooner_55421@...> wrote:
>
> Hi,
>
> Wondering if/how I can add fields/columns to a native grid.
>
> The grid epibinding in thsi case is to "Receipts".
> The collection contains a limited numbers of fields from the PORel table.
> This existing column/collection does not contain all the PORel fields I want.
>
> I've been playing around with "Receipts" in data tools with no success.
>
> Thanks in advance
>