I’ve created similar items to this before, but I cannot get this to only return 1 record, it is doing iteration for each record in time phase, but i dont have the skills to write this any other way.
The only variable i really need is the Part Number being used in time phase, then doing an on hand lookup of bin qty for static bin name.
string combinedMessage = “”;
var tempBin = “JITPROFAB”;
foreach (var ttTimePhas in result.TimePhas)
{
var dbJitBinResult = (from row in Db.PartBin
where row.PartNum == ttTimePhas.PartNum &&
row.BinNum == tempBin /* && */
select row).FirstOrDefault();
// Create a formatted message for each row
string message = $“PartNum: {dbJitBinResult.PartNum},BinNum: {dbJitBinResult.BinNum},OnHandQty: {dbJitBinResult.OnhandQty}\n”;
combinedMessage += message;
}
// Display the combined results in a message box
string body = “Combined Results:\n\n” + combinedMessage;
this.PublishInfoMessage(body, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, “FirstVar”, “SecondVar”);



