Rule Wizard Custom Action

Hello,
I am trying to get a two checkbox fields (CheckBox1 and CheckBox2) in UD101A to never both be true at the same time. I have two row rules one for each check box with a condition when they are true. Then the custom action just sets the relevant checkbox to false based on the row rule being fired. So when checkbox 01 = True Checkbox02 is false.

The strange thing is that when I initially load the data from a search, click on checkbox02 it checks. I click checkbox01 and it unchecks checkbox02 as it should, but if I try to go back the other way checkbox02 flashes checked then clears again.
Basically I want to have similar behavior to radio buttons.

Suggestions Ideas and some mentoring appreciated.

private void UD101ACheckBox02Equalstrue_CustomRuleAction(Epicor.Mfg.UI.ExtendedProps.RowRuleDelegateArgs args)
{
	// ** RowRuleDelegateArgs Properties: args.Arg1, args.Arg2, args.Context, args.Row
	// ** put custom Rule Action logic here
	EpiDataView edvUD101A = (EpiDataView)oTrans.EpiDataViews["UD101A"];
	edvUD101A.dataView[edvUD101A.Row]["CheckBox01"] = "false";


}

Why don’t you use a radio button? If you put both in the same GroupBox they will only be 1 at a time (ON) no Code needed

You mean put a radio button in the Ultragrid? I’ve never done that before. Never thought of that…Thinking it must be time for bed, I have been looking at this for too long…

OH! I didn’t realize it was in a grid!.. Got it!
What about using Field Changed event
Here is an example using 2 random boolean fields

private void OrderHed_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
	{
		// ** Argument Properties and Uses **
		// args.Row["FieldName"]
		// args.Column, args.ProposedValue, args.Row
		// Add Event Handler Code
		switch (args.Column.ColumnName)
		{
	
			case "AutoOrderBasedDisc":
				if((bool)args.ProposedValue)
					args.Row["AutoPrintReady"] = false;
				break;
			case "AutoPrintReady":
				if((bool)args.ProposedValue)
					args.Row["AutoOrderBasedDisc"] = false;
				break;
		}
	}
1 Like

That should work. I’ll give that a go and let everyone know how I get on.

Just another note Thanks. I AM LUUUUVVVING e10Help. Total breath of fresh air.

Examples are a really good help too.

1 Like

Thanks Jose,
That worked a treat.
For posterity

  1. Open Customization

  2. Click Form Event Wizard Pane

  3. Select Event Type After Field Change

  4. Select Table (in this instance UD101A)

  5. Select the Field you want to test that changes

  6. Click the arrow button.

  7. Repeat for any other fields you want to test.

  8. Add the code as Jose mentioned to each test. Comments are pretty self explanatory about the arguments.
    args.ProposedValue is the value the field will be changed to. args.Row[“Fieldname”] is the field you want to affect on in the test.Eg.

private void UD101A_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row[“FieldName”]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{

	case "CheckBox01":
		if((bool)args.ProposedValue)
				args.Row["Checkbox02"] = false;
		break;
	case "CheckBox02":
		if((bool)args.ProposedValue)
				args.Row["Checkbox01"] = false;

		break;
}

}

  1. Click on the Update Selecte Event Code

  2. click on the Script Editor tab and press F5 to confirm that the code will compile cleanly.

I hope someone finds this useful.

1 Like