Good afternoon,
I have a uBAQ that I use to update UD09. In the BPM I am trying to use the part number to get the assembly sequence. I thought I could grab it with something like this, but I am not great with SQL in expressions.
var asm = (from ttResults_Row in queryResultDataset.Results where ttResults_Row.UD09_Key1 == JobAsmbl.PartNum select JobAsmbl.AsmSeq).FirstOrDefault();
MyAsm = asm.JobAsmbl_AsmSeq;
In this case UD09.Key1 is the assembly level part number. The assembly sequence is not stored in UD09. So, I want to use the value from UD09 part number to find the part number in JobAsmbl, and then give back the assembly sequence number.
I am sure I need a join to the Job Asmbl table in there.
Thanks!
Nate
That’s getting it from the database. You are going to get all of the places that the part is used, is ANY job in the database, then just grab the first on the list. You need to match the job number as well.
Also, you can just select the Assembly seq right in the linq query then assign it right to your variable. Saves some memory not selecting the whole row.
MyAsm = (from JobAsmbl_Row in Db.JobAsmbl
where xRow.UD09_Key1 == JobAsmbl_Row.PartNum
&& xRow.UD09_Key4 == JobAsmbl_Row.JobNum
select JobAsmbl_Row.AssemblySeq).FirstOrDefault();
You’re problem was that the variable type is an int… You are treating it like a row, but since you selected a single field, and the first row, it makes it right into the integer.