I can’t seem get this working, I’ve tried it a dozen different ways. I’ve done my homework, read a ton of related posts and not sure what I’m doing wrong. I’m trying to fire a BAQ, in a BPM code block, that grabs specific job information but it seems to be failing to get any results with “No Rows Returned!”. Hoping someone could help me understand what I’m doing wrong. This is a post-processing method directive, “QuickJobEntry.GenerateJob”
Ditto what cfinley said… but also, do you really want that type of dependency, you could query it in a BPM via LINQ and eliminate a BAQ dependency. Code looks okay.
I would agree with hasokeric on potentially eliminating the dependency. Not sure when you upgrade if this BAQ would be caught anywhere as being “used”.
Regardless.
Is the BAQ in the same company?
Not that this is correct, but I recently had some troubles with calling BAQ from a customization. Only differences between my customization and my playground/test area was potentially my isEmpty parameters and my RowMod which I left “”.
It was something I didn’t get time to play around with. But perhaps what you are experiencing as well?
Also, never dived into exploring this. But are BPMs async in any nature? if so perhaps your BAQ is not returning a value before the BPM checks for results
Unfortunately I’m not a programmer by nature and struggle with LINQ queries, otherwise I would do this in a heartbeat.
If you would be so kind as to give an example, using job number from ttQuickJob to pull data from JobProd table with 2 criteria; subcontract = true and and VendorNum = 497, this might eliminate my need for the BAQ.
From my understanding, it would be something like:
JobProd = (var JobProd_iterator in (from JobProd_Row in Db.JobProd
where JobProd_Row.JobNum == ttQuickJobRow.JobNum
&& JobProd_Row.Subcontract == true
&& JobProd_Row.VendorNum == 497
select JobProd_Row))
var Rows =
(from jp in Db.JobProd
where jp.Company == Session.CompanyID
&& jp.VendorNum == 497
select jp
).ToList(); // You can also use .FirstOrDefault() if you only want 1 row
Just for example sake, a JOIN example:
var Rows =
(from jh in Db.JobHead
join jp in Db.JobProd.With(LockHint.NoLock)
on new { jb.Company, jh.JobNum, Subcontract = true } equals new { jp.Company, jp.JobNum, jp.Subcontract }
where jh.Company == Session.CompanyID
&& jp.VendorNum == 497
select jp
).ToList();
@TomAlexander, I’m sorry, I said JobProd but I meant JobOper.
The objective is to only find subcontract operations, the vendor being one of our other companies, there will only be 1 of these ops per job and not all jobs have this operation.
Second is don’t do a SELECT * if you don’t have to:
var JobOper =
(from jo in Db.JobOper
where jo.Company == Session.CompanyID
&& jo.JobNum == Job
&& jo.SubContract == true
&& jo.VendorNum == 497
// Select only what you need for faster query
select new {
jo.Company,
jo.AssemblySeq,
jo.OprSeq
}
).FirstOrDefault();