E10 Form EpiControl properties - EpiCustomValidator example code

I have a need to validate a native text box field entered value (Part Maintenance> Revisions> Detail> Rev field against a user code type (code id) defined. I know I can use a BPM to do this. Furthermore, I know that I can create a drop-down UD field and when the drop-down field populate I can also trigger the value of the native Rev field.

However, I want to approach the solution more holistically by using the EpiControl properties - EpiCustomValidator. Does any have an example of using this property? Can the value of the property be populated dynamically.

See attached snapshots for more details.

/

No snapshot came through. Though keep in mind the cleanest way to do this is as you suggested with a UDCodes drop-down. Writing custom code for this seems un-necesary. You don’t even need a UD field, simply replace the existing field (textbox) with a DropDown that uses the UserCodes as Data Source and it writes directly back to Rev

For some unknown reason I am not able to upload the png or jpg files. It lets me click upload but the reply button at the bottom becomes no longer visible. I closed my browser and it still would not let me.

Try just pasting the Image into the Reply… that seems to work fine

Yeah just what I thought simply replace that TextBox with a dropDown that pulls data from the USer Codes. you shouldn’t have to write any custom code for this.

I was hesitating to do that since this was a text box native control. I am curious, do you have an example of how to use the EpiCustomValidator property?

Is for Context validation, not for data validation as far as I can tell… Replacing the native control is perfectly safe. Just hide the existing one

Just copy the EpiBinding from your native textbox and place it on your custom dropdown

Its working now. However, I need to set the native control text box to invisible. I am able to do this at the form load but it seems there are other form events in which ICE is making the native control text box visible again. Other than the change list and row change events is there a easier way to just make the text box invisible in one event or place.

private void PartForm_Load(object sender, EventArgs args)
{
	// Add Event Handler Code

	// MGA - 30-NOV-2017
	// Set tbRevisionNumber invisible. Using rsiRevisionNumberCombo_txt 
	EpiTextBox textBoxRevisionNum = new EpiTextBox();

	textBoxRevisionNum = (EpiTextBox)csm.GetNativeControlReference("d5a58790-eed2-456a-8453-125c3561c7c7");
	textBoxRevisionNum.Visible = false;

}

private void PartRev_DataView_ListChanged(object sender, ListChangedEventArgs args)
{
	// ** Argument Properties and Uses **
	// PartRev_DataView[0]["FieldName"]
	// args.ListChangedType, args.NewIndex, args.OldIndex
	// ListChangedType.ItemAdded, ListChangedType.ItemChanged, ListChangedType.ItemDeleted, ListChangedType.ItemMoved, ListChangedType.Reset
	// Add Event Handler Code

	// MGA - 30-NOV-2017
	// Set tbRevisionNumber invisible. Using rsiRevisionNumberCombo_txt 

	MessageBox.Show("Part Rev");

	EpiTextBox textBoxRevisionNum = new EpiTextBox();

	textBoxRevisionNum = (EpiTextBox)csm.GetNativeControlReference("d5a58790-eed2-456a-8453-125c3561c7c7");
	textBoxRevisionNum.Visible = false;
}

}

The easiest solution is to move it off the visible form.

Tools - Customization Wizards – Modify Extended Properties – Find your column and set IsHidden = True

1 Like

I can only shrink it and move it around the same group box behind another native control. If that’s what you mean.

This will not work as the column field is native EpiTexBox and has been replaced by the an EpiCombo. Extended field will make both hidden.

In the past when I’ve run into this issue I did something like making an event OnVisibleChanged on the offending control. Then call BringToFront() on my control. This way when ever Epicor tried to make it visible, I plop my control back on top.

Ah. Scrolled up and saw you are using the same field, just different control.

Just remove the bindings from the original text box and hide it / move it off the screen

-Jose

I think I found another holistic solution. In the Extended Property Maintenance, I modified the table PartRev table column (RevisionNum) for the text box native control and specified same UD Code type, saved and tested using the base form, but it did not work. Any ideas why?

According to the application help:

UD Code Type:
The UD Code Type drop-down list indicates that a list of user-defined codes display within this field. You create user-defined codes within User Defined Code Maintenance. If you wish to display a user-defined code list through this field, select the code option you need from this list.