Rowrule enable/disable button click

Thought this was how EpiBindings work.

I am trying to create a rowrule so when there is data in a custom field that a button will be disabled. (not be able to click). This isn’t working as designed in my mind. Is there more to this?

Here is what has been done
Custom field on Part.
Part.LCMInitatedDt_c

Custom button on Part Entry.
btnLCMInitate
EpiBinding of the button to be the custom field.

added a rowrule for the custom field

private void CreateRowRulePartLCMInitatedDt_cLessThanOrEqualTo_Constant_Today()
	{
		// Description: LCMInitateDateNotNull
		// **** begin autogenerated code ****
		ControlSettings controlSettings1EpiReadOnly = new ControlSettings();
		controlSettings1EpiReadOnly.SetStyleSetName("EpiReadOnly");
		RuleAction epireadonlyPart_LCMInitatedDt_c = RuleAction.AddControlSettings(this.oTrans, "Part.LCMInitatedDt_c", SettingStyle.Disabled);
		RuleAction[] ruleActions = new RuleAction[] {
				epireadonlyPart_LCMInitatedDt_c};
		// Create RowRule and add to the EpiDataView.
		RowRule rrCreateRowRulePartLCMInitatedDt_cLessThanOrEqualTo_Constant_Today = new RowRule("Part.LCMInitatedDt_c", RuleCondition.LessThanOrEqualTo, "Constant: Today", ruleActions);
		((EpiDataView)(this.oTrans.EpiDataViews["Part"])).AddRowRule(rrCreateRowRulePartLCMInitatedDt_cLessThanOrEqualTo_Constant_Today);
		// **** end autogenerated code ****
	}

I’m not sure what happens when a button is bound to a field that isn’t the type Boolean.

I’ve never seen this type of value used for rowrules, I’m guessing this is going to do a default comparison between strings.

Assign a unique epibinding to the button, it doesn’t need to exist on the dataview, you can use anything like “Part.CustomButton123”, and use that binding in your read only rowrule.

1 Like

What works (for me) was making a row rule based on the UD field (I don’t have one in Part so I used UserChar01)

  1. Bind the button to an unused field (not the UD field) I bound mine to Part.UserInteger1

  2. Add a Row Rule Like:

Note that to make the rule I initially set the Rule Value: to x. This created the function:
private void CreateRowRulePartUserChar1Equals_x() with the line

RowRule rrCreateRowRulePartUserChar1Equals_x = new RowRule("Part.UserChar1", RuleCondition.Equals, "x", ruleActions);

Which I changed to

RowRule rrCreateRowRulePartUserChar1Equals_x = new RowRule("Part.UserChar1", RuleCondition.Equals, "", ruleActions);

Now whenever UserChar1 is blank, the Test Button becomes disabled.

edit

Whoops … I think you wanted the button disabled when the value was NOT blank. So make your Row Rule accordingly.

1 Like

Thanks

that is what I am testing out based on your comment of Boolean. maybe the date field is not ideal.

You could probably use a custom code action

1 Like

Thanks again for the assist. Got it to work.

I just changed the condition to notequal and it worked. Must not like how I was using the data constant. I may test that out at a later date.

new RowRule("Part.LCMInitatedDt_c", RuleCondition.NotEqual, "", ruleActions);

1 Like

It doesnt have to be a real field - button bindings are made-up like Epicor I just name mine usually TheTableName.btnMyButtonName you have to type it in, unlike a textbox it is not validated and can be used with RowRule engine. It’s the same way Epicor does it.

Even if you don’t use a RowRule the button automatically becomes disabled when there is no record loaded for TableName

1 Like