Where to get Report Filter in Custom Code

I am trying to to get the FromDate and ToDate parameter in the SO Pick List Report when it is printed. How do I retrieve the parameter in custom code? So far when I check in the forum most seems to be for setting the parameters and not retrieving it unless I am mistaken?

To add more details to what I am trying to do I want to be able to retrieve the value of the From Date and To Date inside the Sales Order Pick List Report into custom code but I don’t know where to start.

Using Developer to I understand that in the SubmiToAgent ds.ReportStyle.SOPickListReportParam[0].FromDate and ds.ReportStyle.SOPickListReportParam[0].ToDate is where its stored at but how do I go about calling it in BPM for SysTask?

You can use a pre-processing Method Directive on the Erp.Rpt.SOPickListReport.SubmitToAgent method to grab the FromDate and put it into a BPMData Date field where you should be able to pull it into your report.

Is there a way to pass this value over to the SysTask Data Directive? Or to have it pulled in the Systask Data Directive?

These 2 values are what I need for the Systask for when I print SO Pick List Report as I need this to filter out the order number for inserting into a UD field in OrderHed

Maybe we can step back a moment and explain what business problem you’re trying to solve. Once we know what you’re trying to do, maybe we can find out how we will be able to do it.

Okay, to start with my goal is to prevent users from reprinting the same Order Number in SO Pick List. So if they the So Picklist has printed the Order Number once, if they try to print again it won’t appear in the pick list again.

The simple workflow that I was going for is:

  1. Systask check for Report “SO Pick list” and Status is “COMPLETE”
  2. Code runs to insert + 1 in the counter and insert date into counterdate field
  3. The report printed will filter out the order number with count > 0

What I have done so far is:

  1. Created 2 UD fields in OrderHed SOPickListPrintDate_c and SOPickPrintCount_c to be used to enter the date the order number was last printed and a counter which defaults starts at 0.

  2. Then I have modify the SOPick report to filter out the order numbers that has SOPickPrintCount_c more than 0.

  3. Then, I modified the code from the link below to fit do the same insertion
    Committing updated record to database from a report form - #5 by LReynolds

However, I noticed after modifying and using the code above that there were a few issues with code insertion.

Scenario 1 - Users don’t filter any Order Number and the SO Pick List Report just takes all Order that meets the Date Range requirement.

Results: Report printed all within range but my code did not insert anything because it was checking by Orderlist which was empty. Upon studying I found that it was because my code was using the Orderlist and when no Order Number was taken, the Orderlist is “”.

Scenario 2 - Order filters out say 2 orders, but 1 of the order NeedByDate is not in report filter range.

Results: The report printed out only 1 order number but my code inserts into the 2 Order Number rows instead of only 1.

For both the scenarios I realise I need to pull out the Filter Range Date value in the SO Pick List for my code so it can insert to the correct counter fields BUT I need to have it done in SysTask because I only want the counter to be inserted AFTER Report has run “COMPLETE” and not insert if it ran on “ERROR”.

My code in SysTask is as per below:

string[] OrderArray = new string[] {};
int[] myInts = new int[] {};
char[] Separator = {'~'};
string Orders;

foreach (var ttSysTaskRow in (from ttSysTaskRow in ttSysTask where ttSysTaskRow.TaskDescription == "SO Pick list" select ttSysTaskRow))
{
foreach (var SysTaskParam_iterator in Db.SysTaskParam.Where(SysTaskParam_Row=> SysTaskParam_Row.SysTaskNum == ttSysTaskRow.SysTaskNum && SysTaskParam_Row.ParamName == "OrderList"))
{
Orders = SysTaskParam_iterator.ParamCharacter;

if(Orders == ""){

 //SOPickListReportParam ds = new SOPickListReportParam();
 //SOPickListReportParam[0]
 
 
//Add The Date Range in Filter to filter out the orderHed NeedByDate field?
foreach (var OrderHed_iterator in Db.OrderHed.Where(OrderHed_Row=> OrderHed_Row.VoidOrder == false &&  OrderHed_Row.OpenOrder == true && OrderHed_Row.OrderNum == 0 && OrderHed_Row.Company == callContextClient.CurrentCompany)){
OrderHed_iterator.SOPickListPrintDate_c = DateTime.Today;
OrderHed_iterator.SOPickPrintCount_c = OrderHed_iterator.SOPickPrintCount_c+1;
//OrderHed_iterator.SOPickPrintCount_c = 0;
}

}else{


OrderArray = Orders.Split(Separator);
myInts = Array.ConvertAll(OrderArray, int.Parse);

foreach (int order in myInts){

//Add The Date Range in Filter to filter out the orderHed NeedByDate field?
foreach (var OrderHed_iterator in Db.OrderHed.Where(OrderHed_Row=> OrderHed_Row.VoidOrder == false &&  OrderHed_Row.OpenOrder == true && OrderHed_Row.OrderNum == order && OrderHed_Row.Company == callContextClient.CurrentCompany)){


OrderHed_iterator.SOPickListPrintDate_c = DateTime.Today;
OrderHed_iterator.SOPickPrintCount_c = OrderHed_iterator.SOPickPrintCount_c+1;

}
}
}

}
}


Db.Validate();

====
The only way I can currently think of is to add a UD field into the Systask table and use that to pass parameter from the Erp.Rpt.SOPickListReport.SubmitToAgent method you mentioned but I’m wondering if there is another to pull it without having to do this.

That’s a solution. Is the business problem that multiple people are picking the same orders? Same person picking the same order?

This is a common problem with anything printed. There’s no way to collaborate with others and the document can be out of date by the time we pick it up from the printer. Maybe you could look into some kind of mobile solution like a tablet or phone? Some Epicor/Kinetic users utilize the Fulfillment Workbench for this kind of thing. Requires a license though.

The problem is that multiple people are picking up the same order which was why a counter is used to prevent this.

Just to update I realised I was going in a very unnecessary big roundabout. I didn’t realise there was a sysTaskParam table that stored the FromDate and ToDate param already so RIP me I spend 2-3 weeks creating a UD field and cracking my head trying to figure how to insert it to the UD field because the SOPickList method is just adding the rows to sysTask :face_in_clouds:

I got it to work now by pulling out from the sysTaskParam table which can be done in the Data Directive and using that to filter and boom counter inserts filtering the needby date