I’m trying to get the RowCount from the table in BPM using the method like Pre-Processing & Post-Processing. But i’m not able to get the rowcount. I used the below code. Kindly help on this were i made a mistake in my BPM code.
You dont have to pre-select… you can select and count with one command… try either of these (your choice on formatting). If you dont need the actual data being selected, it is better NOT to select it into a local table, and simply return the count.
int PartCount = (from P in Db.Part where (P.Company == Session.CompanyID && P.PartNum == tmpPartNo) select P).Count();
(I prefer this style:)
int PartCount = Db.Part.Where(P.Company == Session.CompanyID && P.PartNum == tmpPartNo).Count();
OH… Also… if you dont really need the COUNT of the parts, but want to know “Does the part exist”, it is MUCH more efficient to simply ask if there is ANY record… “Any” queries return a “true/false” value. This would be the best. Why? once SQL finds the first one, it stops looking… but when you count, SQL has to find all the records that match so that it can count them.