EpiTextBox value - how to set to null if fieldname.Text contains a value

e10
customization

(Karen Freeman) #1

In the MES screen, in End Activity, a check is required to ensure that a Quality-control field is not populated by an unauthorized operation. To do this, the field value is checked to ensure it’s null. I’m able to clear out the screen value but when viewing the record after the transaction, the unwanted value is saved.

The code snippet below shows the test to see if an operator entered a value into the field, and to clear it if they did. The edvEnd.dataView[edvEnd.Row] code is remarked out because it didn’t work to remove the value saved.

//Clear Rockwell entered by unauthorized operation
if (txtRockwell.Text != “”)
{
txtRockwell.Text = “”;
//edvEnd.dataView[edvEnd.Row].BeginEdit();
// edvEnd.dataView[edvEnd.Row][“MtlInspRockwell_c”] = “”;
//edvEnd.dataView[edvEnd.Row].EndEdit();
MessageBox.Show(“Rockwell entry cleared for Non-Inspect Operation.”);
}


(Bruce Ordway) #2

Do you need to do it in the End Activity form?
I was thinking it might be easier to use a BPM on the Labor.Update for your check/clear?


(Al) #3

as @bordway said, a BPM to do the check and stop the transaction with a warning message to clear the entered ttValue is the easy way -in my opinion as well-, thereby you do not need to null the field behind the UI screen, instead Epicor will state a reason message and asking Employee to clear the field to proceed, so people will be aware of what they are doing.


(Karen Freeman) #4

Hello,
I took your advice and now have the user clearing the erroneously entered field.
Thanks,
Karen


(Karen Freeman) #5

I am attempting to do a BPM on the LaborDtl update transaction to set the LaborQty=0, OpComplete=0 and Complete=0 as well as set JobOper’s OpComplete=0 and QtyCompleted=0 when the End Activity process determines that its the Final Operation and there is missing material issues and missing completed operations on the job.

The BPM should set these values IF and only IF its the last operation on the job.

How do I determine max(OprSeq) in JobOper for the ttLabor.JobNum in a BPM?

Thanks,
Karen


(Al) #6

Hi @kfreeman;
same principle my advice is to stop the transaction by using Exception when these conditions are met NOT to set any of what you mentioned for the same reason -which is- it is better to highlight the target jobs to users/employees at this stage rather than set values on the UI background, may be send an email to the area key user to take action,

with regard to your question of determining the Max. JobOper.OprSeq to use it in your condition, one way i would use is to add a foreach loop for the ttJobNum to go through JobOper rows in the database and do a comparison to an integer variable = zero as a starting value then save the iterator JobOper.OprSeq to that variable at each loop if it is larger than it, something like this:

int MaxJobOperOprSeq = 0;

foreach (var JobOper_iterator in (from JobOper_Row in Db.JobOper
where JobOper_Row.Company == Session.CompanyID
&& JobOper_Row.JobNum == ttLabor.JobNum // OR what ever varibale you used in your code to captur ttLabor.JobNum
select JobOper_Row).ToList())
if (JobOper_iterator != null)
{
if ( JobOper_iterator.OprSeq > MaxJobOperOprSeq)
{
MaxJobOperOprSeq = JobOper_iterator.OprSeq;
}
}
// the saved (casted) value after this loop in MaxJobOperOprSeq is what you need for your next comparison

may be Epiocr C# LINQ expert know a single command to do that, instead of using this conventional method


(Karen Freeman) #7

Thanks Al,
Karen