hahahah, @josecgomez any advice/guide about using C#.NET in UI Customization, which explain or/and give a key tips of What, how, when, and where to use the LINQ C# commands within BO Screen Editor.
You can’t (or rather shouldn’t) use LINQ in the front end… That’s back end talk, front end is all BO’s. I suppose you could use LINQ to loop through stuff in the BOs but it is not necessary.
there are cases when you need to do a customisation that does not exist within the standard events/tools Wizard, e.g. the case that you needed to replace an existed Epicor Grid View by your BAQ, another example, is to add a fields to these type of custom tracker that do not exist on epicor grid collection, and call its value from the database, i have another case i am trying to solve which is calculating a new value based on custom grid and place it in my customized new UD filed on the same tracker view, i am not a C# programmer so i do not know the language command structure on such cases. i.e the built-in sub routines as Engineers usually called this type of programming source code.
The details of my issue:
Epicor View “Job Manager”
i need to add a UD field to show On Hand Qty (Entire Company) - Demand (Entire Company).
The current available (Entire Company) field uses the calculation Quantity Available = Quantity On Hand - Allocated
We do not use the Fulfilment workbench to allocate Qty’s so this gives us meaningless results.
The fields in the form are calculated fields JMPartSum.OnHandQty and JMPartSum.DemandQty
I have added a blank field but don’t know how to get a calculation into it as the fields don’t exist in tables and also how to call this field in the code to put any data into it, may be that needs a subscribe as well.
I am ok with customisations but when it gets into needing LINQ coding non-standard stuff on BO Screen Editor, no idea, i start work from @josecgomez examples.
Screenshot
Try a dynamic query. Jose has a video explaining how to do it.
Thanks Brandon, yes i know i refer to this in my post (the second case), most of the time i started from his great examples, but this case is a bit different, i found a video clip on the Youtube on different chanel close to what i want, i will try it, and i will post the code if any one interested.
Hi everyone,
Unfortunately, i could not find any similar or even far relevant examples on this area to suggest a start point on what LINQ C#.NET commands i can use or alter to suit my need.
so if any one interested on such issues, this is my solution, not perfect but will do the job and i think you will find it useful:
-
Create, and display an EbiNum box, with a different label name on that UI.
-
if you want, you can decompile the JobManager Contract assembly dll to find out how exactly the system calculate this value and what variable type it is, as i think it consider other factors for the qty availability not only the demand and the onhand as i want, however in my case i am happy to use the equation i stated on my post before which is ( Part Available Qty = Entire Part Demand - Entire Part On hand ) then i have run some test and checked the outcome results.
-
Check the Custom view displayed fileds (JMPartSum.OnHandQty and JMPartSum.DemandQty) and the system AvailQty on the UI Data tool, i found that both fields are reading from the PartWhse table
( i have called and test some of my parts on SQL as well):
-
set the properties of your new Displayed field as below to Bind it to a CallContext BPMData from the same type, and make it read only.
-
create a simple BPM pre-process method on job manager UI, and i have run the trace, done some quick test, and found that the best method to hook to is GetMatrix
which will cover my relevant actions which are:
-Entering and/or searching for Part No
-Changing Part no.
-and Refreshing the UI screen.
Note: there are other actions (system event buttons) will trigger this method but they have no effect on my field value.
the BPM will pass the results from the equation you want to the CallContextBPM parameter which bond to my displayed EpiNum box.
Note: i have put a condition to exclude minus figures.
HTH
Actually, this implementation was going to be something I would suggest. I believe that this approach is a bit more forward thinking than the traditional methods of calling queries within the form customization because it will be more adaptable as the dynamic UIs are released.
PS:
…decompile the JobManager Contract assembly dll…
I think this is frowned upon per Epicor, so probably the recommendation should be to not do this, though I understand the value it can provide in this case:
just to complete my solution i have notice that my BPM code is not catering for more than one record in PartWhse which is logicly wrong, so i have updated it to do that:
Erp.Tables.PartWhse PartWhse;
decimal dTTLOnHandQty = 0;
decimal dTTLDemandQty = 0;
foreach (var PartWhse_iterator in (from PartWhse_Row in Db.PartWhse
where PartWhse_Row.Company == Session.CompanyID
&& PartWhse_Row.PartNum == ipPartNum
select PartWhse_Row).ToList())
if (PartWhse_iterator != null)
{
dTTLOnHandQty = dTTLOnHandQty + PartWhse_iterator.OnHandQty;
dTTLDemandQty = dTTLDemandQty + PartWhse_iterator.DemandQty;
}
if(dTTLDemandQty >= dTTLOnHandQty)
{
callContextBpmData.Number01=0;
}
else
{
callContextBpmData.Number01=dTTLOnHandQty-dTTLDemandQty;
}