markdamen
(Mark Damen)
July 31, 2017, 12:01pm
1
Hi
var partBin = Db.PartBin.OrderBy(row => row.BinNum).FirstOrDefault(row => row.Company == Session.CompanyID && row.PartNum == moveRequest.PartNum && row.WarehouseCode == “WH” && row.OnhandQty > 0 ;);
I have this in a BPM - I would like to extend this SELECT query slightly, to only look for Bins where RIGHT(BinNum, 1) DOES NOT equal “C”.
Can somebody modify it for me to do this?
I having considered EndsWith, Substring, Right - but don’t know how to do the != check, and what bits are and aren’t supported.
Many Thanks
Mark
The bellow is using EndsWith. You should test it out. Linq turns the expression into sql and runs it against the database. If it doesn’t have a matching sql command it will throw an exception. It might give you an error.
var partBin = Db.PartBin.OrderBy(row => row.BinNum).FirstOrDefault(row => row.Company == Session.CompanyID &&
row.PartNum == moveRequest.PartNum &&
row.WarehouseCode == “WH” &&
row.OnhandQty > 0 &&
!row.BinNum.EndsWith("C"));
1 Like
markdamen
(Mark Damen)
August 1, 2017, 7:27pm
3
Jeremy, thanks so much – that worked perfectly.