Application Studio Help!

Hello, I’m trying to add Unit Net Volume to the PO Suggestions tab in order to help calculate the volume for products when placing purchase orders. I was able to add the column, but I’m having trouble getting it to retrieve the data as the part data table is not connected to this layer. Can somebody help me with what I can do to bring in this data? More so, I would like to also add a calculated field multiplying the suggested quantity with the net volume!

Thanks,

Phillip Gilbert

1 Like

Check out this post. Create a BAQ with the additional fields required, then link them up to the existing dataset.

Potentially far less complex is to add the data to your dataset in a BPM.

5 Likes

I like it. Way better.

1 Like

Like “what” way better?

@jwphillips’s way of adding extra columns. It looks easier than merging a BAQ with a dataset in app studio.

1 Like

Thank you for clarifying!

To further show my ignorance, can you tell me where I can find this method to customize it? Erp.Contracts.BO.POSugg.dll


In Method Directives, you can search for the BO service and method you need to customize.
In this case, the service is Erp.BO.POSugg … and you’ll have to do a trace to see which method is called to populate the data where you’re wanting to add this field.

I’m having trouble finding anything in there. Everything just points back to Erp.Tablesets.POSuggTableset. I did however find this in Extended Property Maintenance. Any chance I could do it from here?

Looking at the grid from your original post…
Open your browser dev tools to the Network tab and refresh the screen.
On PO Suggestions there are a TON of methods that run right away, but only GetRowsPlant returns the data that gets populated into the grid in question:


Now we can create a Post-Processing BPM on that method (Erp.BO.POSugg.GetRowsPlant) to link the data from each line to its associated Part, grab the information from Part, and paste it into the dataset so that it’s available to be used on the grid.

How did you get that screen to pull up? Also, since you’ve been extremely helpful here, is there a way to do this same concept with a calculated field? For instance, I would really prefer to have a column brought back that shows the suggested order qty multiplied by the Net Volume.

That panel is just the dev tools of the browser - F12 or Ctrl+Shift+I
Are you running Kinetic in the browser?

You can insert just about whatever you can think of, using a BPM!
You can write custom code to perform your calculation and insert the calculated value. Or there’s a query widget which works something like a BAQ to pull your data together - and I believe you can use calculated fields there, too

If you’re bringing both values (suggested order qty and Net Volume) in successfully, you may be able to use an event to perform the calculation with the “calculation” widget. That value then gets stored where ever you have that field bound to.

image


Where did you pull the original database fields from in order to add the new ones into it? I’ve searched everywhere and am not finding the same type of details? Or did you grab this from the details listed in dev tools?

In a BPM, you have access to the data used in the operation performed.

In this case, the dataset returned after the operation is called result, and I added a field to each row of the result.InvcCustTrk table.
image
On the right side of the screen when editing custom code, there is a menu with all the BPM-related data available to be used.

So, I haven’t really done much of any coding, is there anywhere that shows current coding written out more detailed that I can just base it on? Ultimately, I just want to add a calculated field of Part.NetVolume x XRelQty to the SugPoDtl grid within Erp.BO.POSugg.GetRowsPlant

@Pgilbert I was just going to tell you how this worked in classic and hope it worked the same, but I took the opportunity to do the process in Kinetic since I had not before and it was very close to classic.

I added a field called volume_c to the SugPODtl table and then regenerated the data model. Reopened Epicor and the field showed in the data section @jwphillips showed above and was available to add to the grid in application studio. I added a NetVolume to the top part in my list and reopened the screen and got a calculation.

image

/* calc */


foreach (var ttSugPoDtlRow in result.SugPoDtl)
{

    var netVolume = Db.Part.Where(x=>x.Company == CompanyID && x.PartNum ==  ttSugPoDtlRow.PartNum).Select(x=>x.NetVolume).FirstOrDefault();
    
    if(netVolume != null && netVolume != 0)
    {
      var volume = netVolume * ttSugPoDtlRow.XRelQty;

      ttSugPoDtlRow.SetUDField<Decimal>("volume_c",volume);

      Ice.Diagnostics.Log.WriteEntry($"Part {ttSugPoDtlRow.PartNum} volume {volume}");

    }  
}
2 Likes

Thank you everyone for your assistance with this! I believe I got it going now!

2 Likes

mark the solution, so this shows as solved.

Thanks

1 Like