O
OgiKore
Guest
I am attempting to understand why the below section of code is bringing in incorrect response.
For Each row As DataRow In dt.Rows
If row("REC_DATE") IsNot DBNull.Value _
AndAlso row("LOADNUMBER") IsNot DBNull.Value _ ' <-- If REC_DATE & LOADEXPENSE are not NULL &
AndAlso row("LOADNUMBER") > 0 _ ' POSTLOAD cannot be 'Y" and the LOADNUMBER cannot be NULL or > '0'
AndAlso row("LOADEXPENSE") IsNot DBNull.Value _
AndAlso row("POSTLOAD") IsNot DBNull.Value _
AndAlso row("POSTLOAD") IsNot "Y" Then
LoadNumber = row("LOADNUMBER")
Dim loadrow As DataRow = dtLoad.Rows.Find(LoadDict(row("LOADNUMBER")))
The issue is (I tried to attach an image for verification but my "Account has not been verified?"
My DT indeed has 'Y' (no quotes) in the POSTLOAD
DEBUG sees the 'Y' yet calls:
AndAlso row("POSTLOAD") IsNot DBNull.Value _ is seen as TRUE (this is correct as there is a value there)
AndAlso row("POSTLOAD") IsNot "Y" as being TRUE (This is where the issue lies. The value is indeed 'Y' yet it says it is not.)
here is the actual DT I am working with:
ID DESCRIPTION SECTION REC_DATE AMOUNT POSTEXPENSE POSTLOAD POSTPERSONAL EXPENSENAME LOADEXPENSE LOADNUMBER PERSONALEXPENSE DATE_ENTERED
14989 TRIP REVENUE INCOME 04/07/20 00:00:00 544.7400 Y LINEHAUL_PAID 2020028 04/07/20 00:00:00
14990 FUEL SURCHARGE INCOME 04/07/20 00:00:00 104.6100 Y FUEL_SUR_PAID 2020028 04/07/20 00:00:00
14991 REEFER SURCHARGE INCOME 04/07/20 00:00:00 19.0200 Y RFR_FUEL_SUR_PAID 2020028 04/07/20 00:00:00
14992 Broker / Factoring Fees LOAD EXPENSES 04/07/20 00:00:00 20.0500 Y Y BROKERAGE_FEE 2020028 04/08/20 00:00:00
Continue reading...
For Each row As DataRow In dt.Rows
If row("REC_DATE") IsNot DBNull.Value _
AndAlso row("LOADNUMBER") IsNot DBNull.Value _ ' <-- If REC_DATE & LOADEXPENSE are not NULL &
AndAlso row("LOADNUMBER") > 0 _ ' POSTLOAD cannot be 'Y" and the LOADNUMBER cannot be NULL or > '0'
AndAlso row("LOADEXPENSE") IsNot DBNull.Value _
AndAlso row("POSTLOAD") IsNot DBNull.Value _
AndAlso row("POSTLOAD") IsNot "Y" Then
LoadNumber = row("LOADNUMBER")
Dim loadrow As DataRow = dtLoad.Rows.Find(LoadDict(row("LOADNUMBER")))
The issue is (I tried to attach an image for verification but my "Account has not been verified?"
My DT indeed has 'Y' (no quotes) in the POSTLOAD
DEBUG sees the 'Y' yet calls:
AndAlso row("POSTLOAD") IsNot DBNull.Value _ is seen as TRUE (this is correct as there is a value there)
AndAlso row("POSTLOAD") IsNot "Y" as being TRUE (This is where the issue lies. The value is indeed 'Y' yet it says it is not.)
here is the actual DT I am working with:
ID DESCRIPTION SECTION REC_DATE AMOUNT POSTEXPENSE POSTLOAD POSTPERSONAL EXPENSENAME LOADEXPENSE LOADNUMBER PERSONALEXPENSE DATE_ENTERED
14989 TRIP REVENUE INCOME 04/07/20 00:00:00 544.7400 Y LINEHAUL_PAID 2020028 04/07/20 00:00:00
14990 FUEL SURCHARGE INCOME 04/07/20 00:00:00 104.6100 Y FUEL_SUR_PAID 2020028 04/07/20 00:00:00
14991 REEFER SURCHARGE INCOME 04/07/20 00:00:00 19.0200 Y RFR_FUEL_SUR_PAID 2020028 04/07/20 00:00:00
14992 Broker / Factoring Fees LOAD EXPENSES 04/07/20 00:00:00 20.0500 Y Y BROKERAGE_FEE 2020028 04/08/20 00:00:00
Continue reading...