Ready operations dashboard highlight

Hi all,

I have a simple scheduling dashboard with op details in grids, updateable for adding scheduling comments. We have highlighting rules using calculated columns from a subquery on the BAQ which calculates Issued Qty and “Can Make Qty” (total on hand / per op). We highlight dashboard rows where either of these is > 0. This part is working.

We also have a uBAQ directive here that creates concatenated fields for Current Op and Remaining Ops. This is also working.

Now I want to add a new row highlight for ops where material is issued AND the previous Op is complete (or if this is the first op) to indicate ops that are “Ready.”

I tried creating a column for this and calculating it in the uBAQ, but I’m getting “true” results in the dash with 0 issued material. I must be doing something wrong. Snip below.

What is your calculated field? Where is the code for it? If you copy and paste code it is much easier to review than images of code. Type in three backticks ` then paste your code and enter three more backticks to end the code block.

/```
Like this just without the /
/```

Hey Nate,

I got something semi-working today, but I’m sure it’s a total mess and probably redundant. I will post my solution in the morning for you guys to laugh at.

Basically I’m filling a BAQ calculated field via uBAQ with the “current” op sequence and then in the dashboard I’m highlight rows where JobOper.OprSeq = calculated field. I think I just did way too much, given that the BAQ filters completed ops and OprSeq should always be the current op.

I have done something similar to show the op list as a string with just the current op highlighted. In this BAQ, I made a subquery that returned the current op. I just set the criteria on the JobOper table to OpComplete - false, then used a calculated field to show the lowest op sequence of the incomplete ops. This goes into our calculated field as “NextOp”. Then, in another subquery I pull all the ops for the job, and I use a calculated field to show the whole list of ops, with the next op bold and underlined (using HTML tags). This all works pretty good for our use in the report. I have attached here for you to look at. You will almost certainly need to adjust the filters to get any results.
Good luck!
SCShipList.baq (94.9 KB)

1 Like

Hey Nate,

I was trying to create a column to use for a new view rule on a dashboard grid. We were already using 2 subqueries in the BAQ to calculate an Issued Qty and a “Can Make” Qty (ohq/qty per) to create yellow highlighted rows for “available” ops so to speak.

What they wanted was a 3rd condition for “Ready” ops using the green OK highlight, with Ready defined as issued material, plus the previous op is complete.
But because the highlight view rules can only compare 2 fields, I was struggling.

The BAQ looks like this:

What I ultimately did and it works, sort of, is stuck this the following into a post uBAQ directive on GetList. I am somewhat ashamed of this but posting it anyway because I love this forum.

//Define additional table references.
Erp.Tables.JobMtl JobMtl;

//Loop through each Result row.
foreach (var ttResults_xRow in result.Results)
{

  var ttResultsRow = ttResults_xRow;
  
  //Iterate each JobMtl row matching JobHead and find the sum of JobMtl.IssuedQty
  decimal qtyissued = 0;
  
  foreach (var JobMtl_iterator in (from JobMtl_Row in Db.JobMtl
    where JobMtl_Row.Company == ttResultsRow.JobHead_Company
    && JobMtl_Row.JobNum == ttResultsRow.JobHead_JobNum
    && JobMtl_Row.IssuedQty > 0
    select JobMtl_Row))
  {
    var JobMtlRow = JobMtl_iterator;
    qtyissued += JobMtlRow.IssuedQty;
  }
 
  //ttResultsRow.Calculated_ReadyOp = qtyissued.ToString();  
  
    //Loop through and match the JobAsmbl row with the Result row.
    foreach (var JobAsmbl_iterator in (from JobAsmbl_Row in Db.JobAsmbl
        where JobAsmbl_Row.Company == ttResultsRow.JobHead_Company
        && JobAsmbl_Row.JobNum == ttResultsRow.JobHead_JobNum
        && JobAsmbl_Row.AssemblySeq == ttResultsRow.JobAsmbl_AssemblySeq
        select JobAsmbl_Row))
    {
        var JobAsmblRow = JobAsmbl_iterator;
        int targetSeq = 0;
        int loopCount = 0;
        bool targetFound = false;
        
        //Loop through each JobOper row that matches the JobAsmbl row
        foreach (var JobOper1_iterator in (from JobOper_Row in Db.JobOper
          where JobOper_Row.Company == JobAsmblRow.Company
          && JobOper_Row.JobNum == JobAsmblRow.JobNum
          && JobOper_Row.AssemblySeq == JobAsmblRow.AssemblySeq
          && string.Compare(JobOper_Row.OpCode ,"TRANSFER",true)!=0
          orderby JobOper_Row.OprSeq
          select JobOper_Row))
        {
        
          var JobOperRow = JobOper1_iterator;
          bool isOpComp = JobOperRow.OpComplete;
            
            if (isOpComp)
            {
              loopCount++;            
            }
            else
            {
              if(targetFound==false) 
              {
                targetSeq = JobOperRow.OprSeq;
                targetFound=true; 
              
              }
            }
         }
        
      //Assign target op to calc column
      if(qtyissued > 0 && targetSeq > 0) 
      {
          ttResultsRow.Calculated_CurrentOp = targetSeq.ToString();
      {
    }
   } 
 }  
}

Then on the dashboard, I just set a view rule to Calculated_CurrentOp = JobOper.OprSeq. So there it is. I’m sure I did way too much and it can be done better.

Thanks for your help!

1 Like

If it’s stupid but it works, then it’s not stupid.

Actually, if it’s stupid but it works, it’s inelegant.

1 Like