I have a query which runs and on the Post Processing Get List I need to create a BPM that will find some records and update them based on the data returned by the query.
The First thing i need to do is goto the DemandContractHdr Table to Get the ContractNum.where the Demand Contract is equal to the one returned from ttResults
Then based on this find the DemandContractDtl Record
Based on the data Returned From DemandContractDtl update the DemandDetailImport table with the Contract Line Number.
The BPM Compiles with no errors but does not seem to update the field.
When are you getting the “GetList” data? I know after you process the incoming demand, that detail disappears from the Demand*Import tables.
I did no testing on this so you may have to do some tweaking. I think the issue is you need to set the tt.DemandContractLine to the value:
foreach(var tt in ttResults)
{
int demandLine =
(from DemandContractHdr_Row in Db.DemandContractHdr
join DemandContractDtl_Row in Db.DemandContractDtl on new {p0=DemandContractHdr_Row.Company, p1=DemandContractHdr_Row.DemandContract} equals new {p0=DemandContractDtl_Row.Company, p1=DemandContractDtl_Row.DemandContract}
join DemandDetailImport_Row in Db.DemandDetailImport on new {p0=DemandContractDtl_Row.Company, p1=DemandContractDtl_Row.DemandContract, p2=DemandContractDtl_Row.PartNum} equals new {p0=DemandDetailImport_Row.Company, p1=DemandDetailImport_Row.DemandContract, p2=DemandDetailImport_Row.PartNum}
where DemandDetailImport_Row.Company == Session.CompanyID && DemandDetailImport_Row.DemandContract == tt.DemandHeadImport_DemandContract && DemandDetailImport_Row.PartNum == tt.DemandDetailImport_PartNum
select DemandContractDtl_Row.DemandContractLine
).FirstOrDefault();
tt.DemandContractLine = demandLine;
}