@srennels First step is to get your main BAQ to be filtered by a subquery. Add an inner sub query on JobAsmbl and hard code the job and assemblyseq you want to show in the main to test the subquery. Group that by Company, JobNum, AssemblySeq. Then after that works add a join to your UD table to get the job numbers and assemblies to filter from the data entered.

The bpm is pre-processing on the main query, so the UD data is there before the query runs.

This is the custom code block.
/* build UD24 data from bpm data form */
UD24Tableset udds = new UD24Tableset ();
Ice.Tables.UD24 UD24;
using (var txscope = IceDataContext.CreateDefaultTransactionScope())
{
foreach (var _UD24 in Db.UD24.Where(u=> u.Key1 == Session.UserID && u.Key2 == "MyData"))
{
Db.UD24.Delete(_UD24);
}
txscope.Complete();
}
List<string> AsmSeqList = (callContextBpmData.Character01.Split(',')).Select(t => t.Trim()).ToList();
foreach (var AsmSeq in AsmSeqList)
{
using(var UD24BO = Ice.Assemblies.ServiceRenderer.GetService<UD24SvcContract>(Db,true))
{
var dataRow = udds.UD24.Where(u => u.Company == Session.CompanyID && u.Key1 == Session.UserID && u.Key2 == "MyData" && u.Key3 == callContextBpmData.Character02 && u.Key4 == AsmSeq).FirstOrDefault();
if(dataRow == null)
{
UD24BO.GetaNewUD24(ref udds);
var aUD24 = udds.UD24.LastOrDefault();
aUD24.Company = Session.CompanyID;
aUD24.Key1 = Session.UserID;
aUD24.Key2 = "MyData";
aUD24.Key3 = callContextBpmData.Character02; //job number
aUD24.Key4 = AsmSeq;
aUD24.Key5 = ""; //Guid.NewGuid().ToString();
UD24BO.Update(ref udds);
}
}
}