UI Customization - Form Event Wizard Table Missing From List

Attempting to make a UI Customization of DMR Processing, and need to react “before field change” or “after field change” according to DMRActnReject.ReasonCode, shown here.

Unfortunately the table can’t be selected in the table dropdown list in Form Event Wizard.

Are there any of the wizards or Data Tools I can use, to make it available?

Thank you,
…Monty.

Just use a different table to generate the code and update the code manually, see if it works.

DMRActnReject is EpiDataView. But the table it uses is actually DMRActn with a filter of ActionType = ‘R’

So simply use DMRActn and it should trigger still for your field.

The DMRActn table is split up with filters into the following DataViews (but the same table):
For Reference

DMRActnRejectView.StaticFilter = "ActionType = 'R'";
DMRActnStockView.StaticFilter = "ActionType = 'A' AND DestinationType = 'S'";
DMRActnMtrlView.StaticFilter = "ActionType = 'A' AND DestinationType = 'M'";
DMRActnOprView.StaticFilter = "ActionType = 'A' AND DestinationType = 'O'";
DMRActnDebitView.StaticFilter = "(ActionType = 'D' OR ActionType = 'C' OR ActionType = 'I')";
DMRActnCustView.StaticFilter = "ActionType = 'A' AND DestinationType = 'C'";

Thanks Haso! In attempting to do this, I discovered there already is such a case in our existing custom code on this form, but it’s not working. Another two controls, these custom controls mapped to Character01 and Character02, are supposed to inform each other, and these are also bound to DMRActnReject and set to trigger on After Field Change by wizard code. Instead the action is never triggered. The message box in this code is displayed when the form loads:

public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		this.DMRActn_Column.ColumnChanged += new DataColumnChangeEventHandler(this.DMRActn_AfterFieldChange);
		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		SetExtendedProperties();
		this.btnAddToLog.Click += new System.EventHandler(this.btnAddToLog_Click);
		// End Wizard Added Custom Method Calls
		MessageBox.Show(" initialized custom code");
	}

… but the one in this section does not display a message when the user changes the Character01 field:

private void DMRActn_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
	{
		// ** Argument Properties and Uses **
		// args.Row["FieldName"]
		// args.Column, args.ProposedValue, args.Row
		// Add Event Handler Code
		MessageBox.Show(" after field change DMRActn triggered");
		switch (args.Column.ColumnName)
		{
			case "Character01":
			// If Character01, the top level quality code, is being changed, then the
			//  subordinate Character02, quality code detail, should be blanked-out.
			if (args.Row["Character02"] != null)
			{
				args.Row["Character02"]="";
				oTrans.Update();                // save
    		}
				break;
		}  // end switch
	} // end method

Unfortunately this may have been broken since we upgraded from 9 to 10, and we never caught it because it’s supposed to handle a user error that would be unusual. Do you see any clues as to why it’s not being hit?

Sincerely
.Monty.

It definitely seems broken even in 10.2.400.

The only thing I can suggest is

  1. Use BeforeAdapterMethod on PreUpdate and validate there.
case "PreUpdate":
  1. Use RowRules ColumnValueChanges or Column Not Equal with a Custom Action

Thanks Haso! @hkeric.wci

Have you seen this before, where wizard-based code just doesn’t get triggered? I don’t mind trying your ideas but just wondering why the existing code doesn’t work and the need to abandon it. Should we attempt to remove the wizard-based code so it doesn’t bloat the customization, if it can’t be made to work?

I have not, one thing that also strikes me if you add it and come back the wizard code shows the method duplicated many times.

image

It looks like the form itself has that many ColumnChange events and it thinks they are yours “Customized” and I think one of the events is probably stopping the others with something like args.Handled or args.Cancelled.

Dear Haso,

Thank you for these ideas. When I start with Base code, and only do Before Field Change or After Field Change on the ReasonCode field in 10.2.300.9, I do NOT see all those duplications in the event handler list, only my own. But I do not get triggered in either case, so I’m not able to take the custom action needed.

I just tried your idea about the PreUpdate adapter trigger, but it doesn’t get triggered until the user tries to save; I need something to happen when the field gets changed. I enabled the message box before the case statement, and found that no adapter event gets triggered when the reason code is changed, so I doubt I can use that method to do what I want.

I have tried once before doing a row rule, but I hit a snag when I tried to do a custom action that does anything except change style things; I will try that idea again now. All best,
…Monty.

@hkeric.wci

I attempted the row rule with code handler in this way:

Unfortunately the code it generates does not get triggered:

private void CreateRowRuleDMRActnRejectReasonCodeColumnValueChanges()
{
// Description: Change Reject Reason
// **** begin autogenerated code ****
RuleAction[] ruleActions = new RuleAction[0];
// Create RowRule and add to the EpiDataView.
// Dummy Context Object
object contextObject = null;
RowRule rrCreateRowRuleDMRActnRejectReasonCodeColumnValueChanges = new RowRule(“DMRActnReject.ReasonCode”, RuleCondition.ColumnValueChanges, “DMRActnReject.ReasonCode”, new RowRuleActionDelegate2(this.DMRActnRejectReasonCodeColumnValueChangesDMRActnRejectReasonCode_CustomRuleAction), contextObject);
((EpiDataView)(this.oTrans.EpiDataViews[“DMRActnReject”])).AddRowRule(rrCreateRowRuleDMRActnRejectReasonCodeColumnValueChanges);
// **** end autogenerated code ****
}

private void DMRActnRejectReasonCodeColumnValueChangesDMRActnRejectReasonCode_CustomRuleAction(Ice.Lib.ExtendedProps.RowRuleDelegateArgs args)
{
	// ** RowRuleDelegateArgs Properties: args.Arg1, args.Arg2, args.Context, args.Row
	// ** put custom Rule Action logic here
	EpiMessageBox.Show("hit event handler");
}

Can you see what I’m doing wrong in assembling the event handler?

Thanks much
…Monty.

Thanks Everyone; I managed to get it done with a form event, creating a custom hidden dropdown field and triggering on its value changing. The code is below.

All best
…Monty.

Blockquote
public bool flgChangeTriggered = false;

private void cmbCustomReason_EpiComboChanged(object sender, System.EventArgs args)
{
	// ** Place Event Handling Code Here **
	EpiDataView edvDMRActnReject = ((EpiDataView)(this.oTrans.EpiDataViews["DMRActnReject"]));
	if (edvDMRActnReject.HasRow && !flgChangeTriggered)
	{ // data view has row?
		System.Data.DataRow edvDMRActnRejectRow = edvDMRActnReject.CurrentDataRow;
		// 
		if (edvDMRActnRejectRow["ReasonCode"].ToString().StartsWith("RTV"))
		{ // reason code value starts with RTV?
			flgChangeTriggered = true;
			edvDMRActnRejectRow["Resolution"] = "CREDIT";
		} // end if reason code value starts with RTV
	} // end if data view has row
} // end method cmbCustomReason_EpiComboChanged