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’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.
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.
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