Custom Row Rule Condition Compiles but Doesn't work

Hi everyone,
I have a custom row rule condition which I want to check two checkboxes and if one is true and the other false then disable a third checkbox. Code below compiles and the message box displays ‘True’ and ‘False’ but nothing happens to the checkbox I want disabled. Can anyone help?


private void CreateRowRuleQuoteDtlDrgAwaitingApproval_cCustomCondition_True()
	{
		// Description: LockDrgApproved
		// **** begin autogenerated code ****
		RuleAction disabledQuoteDtl_DrgApproved_c = RuleAction.AddControlSettings(this.oTrans, "QuoteDtl.DrgApproved_c", SettingStyle.Disabled);
		RuleAction[] ruleActions = new RuleAction[] {
				disabledQuoteDtl_DrgApproved_c};
		// Create RowRule and add to the EpiDataView.
		RowRule rrCreateRowRuleQuoteDtlDrgAwaitingApproval_cCustomCondition_True = new RowRule("QuoteDtl.DrgAwaitingApproval_c", new RowRuleConditionDelegate2(this.QuoteDtlDrgAwaitingApproval_cTrue_CustomRuleCondition), true, ruleActions);
		((EpiDataView)(this.oTrans.EpiDataViews["QuoteDtl"])).AddRowRule(rrCreateRowRuleQuoteDtlDrgAwaitingApproval_cCustomCondition_True);
		// **** end autogenerated code ****
	}
	private bool QuoteDtlDrgAwaitingApproval_cTrue_CustomRuleCondition(Ice.Lib.ExtendedProps.RowRuleDelegateArgs args)
	{
		bool result = false;
		// ** RowRuleDelegateArgs Properties: args.Arg1, args.Arg2, args.Context, args.Row
		// ** put Row Rule condition evaluation logic here

		var drgRequired = args.Row["DrgRequired_c"];
		var drgDone = args.Row["DrgAwaitingApproval_c"];
		// Check condition of each checkbox
		MessageBox.Show("Drawing Required  is " + drgRequired + " Drawing Done is " + drgDone);
		if(drgRequired == "True" && drgDone == "False")
		{
			result = true;
		}
		return result;
	}
private bool QuoteDtlDrgAwaitingApproval_cTrue_CustomRuleCondition(Ice.Lib.ExtendedProps.RowRuleDelegateArgs args)
{
  bool result = false;
  // ** RowRuleDelegateArgs Properties: args.Arg1, args.Arg2, args.Context, args.Row
  // ** put Row Rule condition evaluation logic here

  bool drgRequired = Convert.ToBoolean(args.Row["DrgRequired_c"]);
  bool drgDone = Convert.ToBoolean(args.Row["DrgAwaitingApproval_c"]);
  // Check condition of each checkbox
  MessageBox.Show("Drawing Required  is " + drgRequired + " Drawing Done is " + drgDone);
  if(drgRequired == true && drgDone == false)
  {
    result = true;
  }
  return result;
}
1 Like

Thank you! thank you! @hkeric.wci

It works perfectly now :grinning: