How To: Adding Columns to Existing Kinetic Grid

Ok, I see. Now the issue is the method. I’ve done a trace and it looks like the table that I need (SugPoDtl) is being pulled in through GetDatasetTables with a few others. Is this the method I should modify?

That looks like it’s building the dataviews for storing the data for the page.
I would suggest looking at the GetRowsPlant method that has the data for the grid:


So then you go create a BPM for Erp.BO.POSuggSvc/GetRowsPlant

I’ll write up an example as I have time

Thank you, so much!

You can try something like this in a custom code widget in your BPM:

if (result.SugPoDtl.Count < 1)
{
    return; // There are no rows, so no need to add anything. Do nothing.
}

string thisCompany = callContextClient.CurrentCompany;

var allParts = result.SugPoDtl.Select(sugPoDtl => sugPoDtl.PartNum).Distinct().ToList(); // This grabs a list of all the parts in your suggestions

var partInfo =
    Db.Part
        .Where(part => part.Company == thisCompany && allParts.Contains(part.PartNum)) // This filters to only the Parts relevant to your grid
        .Select(part => new { PartNum = part.PartNum, UDField = part.ShortChar02 }) // This grabs just the info needed per Part
        .ToList(); // This runs the query and makes a list you can use repeatedly

foreach (var sugPoDtl in result.SugPoDtl)
{
    string sugPoDtl_PartNum = sugPoDtl.PartNum; // 
    var thisPartInfo = partInfo.FirstOrDefault(pi => pi.PartNum == sugPoDtl_PartNum); // Match the Part info to the SugPoDtl

    // At this point, we have one SugPoDtl and one object with Part UD Field ... so set the value for your grid:
    sugPoDtl["MyUDField"] = thisPartInfo.UDField;
}

Let me know if you have any questions. I didn’t actually test this, just patterned it after another BPM I have

Note: I used the ternary conditional operator (?) to check for a null value there at the end
it’s basically the same as:

if (thisPartInfo == null)
{
    sugPoDtl["MyUDField"] = ""; // then store an empty string
}
else
{
    sugPoDtl["MyUDField"] = thisPartInfo.UDField; // otherwise, give me its UDField value
}

It’s just a lot less wordy

Thank you Jonathan! I’ll try this out and let you know.

Jonathan I finally got time to try this. Unfortunately, when i run the PO Suggestions now, I’m getting two errors. Both look like this:
image

Here is the custom code:

Not sure what I’ve done wrong or missed. Code compiles fine.

Kathie

Here is a snippet from the server as well.

Ok, never mind. I was able to get the errors resolved. Sorry to bother.

1 Like

Jonathan, all working now! My UD column is coming in and it all looks good. Thank you so much for all your help. I really appreciate it.

Kathie

GIF by NBA

Sorry I wasn’t able to help this time - I got pulled away right after I saw your message - but I’m glad to hear you got it working!

1 Like

No worries, I understand. I appreciate all your help!

I followed these instructions but still am not seeing it populate into the grid. I see the matches.{field} get updated in the row update with the value but I am not seeing it populate in the grid. I added JobMtl_PartNum into the SchedulingBoard dataview.
image
Filter the BAQDataView:
image
Updating the added column in the schedulingboard data view with the BAQDataView:
image
We see it filters and does a row update:


Nothing populated:
image
This field is set to SchedulingBoard.JobMtl_PartNum. Should the EPBinding be set to something else??

Nevermind :man_facepalming: needed to add the column field as the field name on the dataview not the ep binding… Thanks!

Does anyone know if it’s possible to use a mdi icon in an added column?
Would like to create a situation that a person can click on a in-line print icon.