Using Row Rule Custom Condition

Hi everyone,
I am attempting to create a row rule using a custom condition. In the wizard it looks like this;
image
I put 5 in the rule value because that is what was done in the Customization User Guide
This is the auto generated code with my condition added. I eventually want to compare with 2 UD fields, ie; greater than UD field 1 and less than UD field 2, but as I can not even get past the first hurdle I have hard coded values instead.

private void CreateRowRuleQuoteDtlDocInExpUnitPriceCustomCondition_5()
	{
		// Description: Low Price
		// **** begin autogenerated code ****
		RuleAction warningQuoteDtl_DocExpUnitPrice = RuleAction.AddControlSettings(this.oTrans, "QuoteDtl.DocExpUnitPrice", SettingStyle.Warning);
		RuleAction[] ruleActions = new RuleAction[] {
				warningQuoteDtl_DocExpUnitPrice};
		// Create RowRule and add to the EpiDataView.
		RowRule rrCreateRowRuleQuoteDtlDocInExpUnitPriceCustomCondition_5 = new RowRule("QuoteDtl.DocInExpUnitPrice", new RowRuleConditionDelegate2(this.QuoteDtlDocInExpUnitPrice5_CustomRuleCondition), 5, ruleActions);
		((EpiDataView)(this.oTrans.EpiDataViews["QuoteDtl"])).AddRowRule(rrCreateRowRuleQuoteDtlDocInExpUnitPriceCustomCondition_5);
		// **** end autogenerated code ****
	}
	private bool QuoteDtlDocInExpUnitPrice5_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
		double price = System.Double.Parse(args.Arg1.ToString());
		if ((price >= 100) && (price <= 150))
		{
		return true;
		}
		return result;
	}

The code compiles but nothing happens when the DocExpUnitPrice is changed to a value between 100 and 150.
Thanks in advance
Adrian

My 2 cents…
Never used it, but if I put a rule value of 5, maybe return 5 instead of true and any other number for false maybe when you want the rule to activate?

or redo it by choosing a value of true?

Pierre

Hi Pierre,
I have it working now but I want to change the hard coded ‘100’ and ‘150’ values to ud field values on the QuoteDtl form. Do you know the correct syntax for doing this. For example;

price >= udfield1 && price <= udfield2

Thanks for your help
Adrian.

If the UD fileds are static (meaning not changing as parameters) you could read them during your form’s initialization into variables. And use those variables in your code.

(sorry I do not know how to add the nice reference box to other topics)
Retrieve data in customization