I need to make a if-else statement in the query meaning I only want to add the OpenAmount to ExpectedAmount if the type = Cash, the problem is that it only gives me the cash row not the other row.
Dim TenderList = (From t In EnData.BatchRecs
Join b In EnData.RegShifts
On t.BatchID Equals b.RegShiftID
Where t.BatchID = ID
Let ExpectedAmount = (t.ExpectedAmount + b.OpeningAmount)
Where t.TenderName = "CASH"
Select t.BatchRecID, ExpectedAmount, t.ExpectedCount,
t.PickUpAmount, t.TenderName, OverShort,
t.PickUpCount, t.TenderID)
Can this be done?
You should be able to use a conditional statement.
You also don’t need
Where t.TenderName = "CASH"if you do this.