Odd problem looping through JobHead -- won't loop 10.2.300

Hey folks,

Anyone ever seen this?

I have a data directive on SysTask to fire when MRP completes, read through jobs, and update each job.

I can use a FirstOrDefault LINQ query to read a single job header. But when I try to loop through it I get no records. Below is a section of code.

I’ve tried three different queries. The first two are commented out. The current tries to read in the whole list and then process the list. It doesn’t matter if I have the “where” code or not – no records.

I’m referencing a particular job for testing so I don’t get a bunch of records for now, but it doesn’t seem to matter whether it’s included or not.

Have an idea. Or alternative?

Thanks,

Joe

/*
var ttJobHead_xRow = (from row in Db.JobHead This one works and returns the referenced job.
where row.Company == Session.CompanyID &&
row.JobFirm == true &&
row.JobReleased == false &&
row.JobComplete == false &&
row.JobNum == "022002-1-1"
select row).FirstOrDefault();

foreach(var ttJobHead_xRow in (from row in Db.JobHead This one returns no records (with or without “where”)
where row.Company == Session.CompanyID &&
row.JobFirm == true &&
row.JobReleased == false &&
row.JobComplete == false &&
row.JobNum == "022002-1-1"
select row))
*/

var jobHeadRows = (from row **in** Db.JobHead This one returns no records (with or without “where”)
/*where row.Company == Session.CompanyID &&
row.JobFirm == true &&
row.JobReleased == false &&
row.JobComplete == false &&
row.JobNum == "022002-1-1" */
select row).ToList();

**foreach** (var ttJobHead_xRow **in** jobHeadRows)
{

This is a total shot in the dark, but if you use the BO inside of the BPM with the ServiceRender and call a GetRows for the JobHead, are you able to return the data?
Example with the QuoteSvcContract:

using(Erp.Contracts.QuoteSvcContract quoteSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.QuoteSvcContract>(Db))
{
}

Session.CompanyID is probably not populated @jdtrent inside a task running in MRP. Just remove that from the whereClause or hard code it.

JobEntry.GetRows seems to have done the trick.

Thanks, Aaron.

Joe

Jose,

It probably didn’t like the session, too, but the whole LINQ thing seemed not to work either. I used JobEntry.GetRows and it seems to have worked.

Thanks,

Joe