There are chunks of code missing from your example...
The first subroutine isn't closed, there is a 'next' with no 'for', etc.
*John Driggers*
**
*Chief Data Wrangler*
*
*
*I have an Epicor blog <http://usdoingstuff.com/>. How useful is that?*
*
*:: 904.404.9233
:: waffqle@...
:: http://www.usdoingstuff.com <http://www.usdoingstuff.com/>
*
*
The first subroutine isn't closed, there is a 'next' with no 'for', etc.
*John Driggers*
**
*Chief Data Wrangler*
*
*
*I have an Epicor blog <http://usdoingstuff.com/>. How useful is that?*
*
*:: 904.404.9233
:: waffqle@...
:: http://www.usdoingstuff.com <http://www.usdoingstuff.com/>
*
*
On Tue, Feb 19, 2013 at 9:21 AM, chan213419 <chan213419@...> wrote:
> **
>
>
> I am VERY close to achieving what I need and it's driving me nuts. I need
> my code to add and populate a "Failed" column to an epigrid, then SUBTRACT
> that result from edv "edvJMSupply.WipQty" and populate a "True Wip" column
> with the result.
>
> The code populates the "Failed" column as it should, but it subtracts the
> FIRST returned value for "edvJMSupply.WipQty" for my "True Wip" column.
> This results in repeating the first WipQty, and subtracting the correct
> amount.
>
> Sub InitializeCustomCode()
>
> edvJMSupply = CType(oTrans.EpiDataViews("JMSupply"), EpiDataView)
>
> If Not (edvJMSupply.dataView.Table.Columns.Contains("Failed"))
> edvJMSupply.dataView.Table.Columns.Add(new DataColumn("Failed"))
> edvJMSupply.dataView.Table.Columns("Failed").ExtendedProperties("ReadOnly")
> = True
> End If
>
> If Not (edvJMSupply.dataView.Table.Columns.Contains("True WIP"))
> edvJMSupply.dataView.Table.Columns.Add(new DataColumn("True WIP"))
> edvJMSupply.dataView.Table.Columns("True
> WIP").ExtendedProperties("ReadOnly") = True
> End If
>
> Private Sub AddTrueWip()
>
> If Not (edvJMSupply.dataView.Table.Columns.Contains("Failed"))
> edvJMSupply.dataView.Table.Columns.Add(new DataColumn("Failed"))
> edvJMSupply.dataView.Table.Columns("Failed").ExtendedProperties("ReadOnly")
> = True
> End If
>
> If Not (edvJMSupply.dataView.Table.Columns.Contains("True WIP"))
> edvJMSupply.dataView.Table.Columns.Add(new DataColumn("True WIP"))
> edvJMSupply.dataView.Table.Columns("True
> WIP").ExtendedProperties("ReadOnly") = True
> End If
>
> '//Loop through every row in the grid and populate the Row
>
> 'Add Failed Qty
> If IsDBNull(dr("Failed")) Then
> dr("Failed") = getDMRRejects(dr("JobNum"))
> End If
>
> `Add True Wip
> If IsDBNull(dr("True Wip")) Then
> dr("True Wip") = edvJMSupply.DataView(edvJMSupply.Row)("WipQty") -
> getDMRRejects(dr("JobNum")) ' <-- RETURNS the first WipQty & Repeats!
> End If
> Next
>
> END SUB
>
> Private Function getDMRRejects(ByVal jobnum as String) As String
> Dim TotalFailed As String
> Dim recordSelectedRel As Boolean
> Dim showSearch As Boolean = False
> Dim whereClauseRel As String = "Company = '" & oTrans.Session.CompanyID &
> "' AND JobNum = '" & jobnum & "'"
> Dim dsDMR As DataSet = SearchFunctions.listLookup(oTrans,
> "DMRProcessingAdapter", recordSelectedRel, showSearch, whereClauseRel)
>
> If (recordSelectedRel = True) Then
> For i As Integer = 0 to dsDMR.Tables(0).Rows.Count-1
> TotalFailed = TotalFailed + dsDMR.Tables(0).Rows(i)("DispTotRejectedQty")
>
> Next
> End If
> Return TotalFailed
>
> END FUNCTION
>
> Thanks for reading... i know i'm missing something small here, and I know
> you geniuses can probably point it out.
>
>
>
[Non-text portions of this message have been removed]