I need to create a Rule on 2 conditions on a Data View. I have tried using the Rule Wizard but it only has one condition available to choose from how would I do two conditions.
My Data View: GS_Order_Detail_DataView
Conditions: if GS_EditComplete_c = True and if tbOrderChecklistTrueFalse.Text = “False”
Then hide gbHidePricing.
I have this code so far and it is not working at all.
{
// Description: EditingNotComplete
// **** begin autogenerated code ****
RuleAction[] ruleActions = new RuleAction[0];
// Create RowRule and add to the EpiDataView.
// Dummy Context Object
object contextObject = null;
RowRule rrCreateRowRuleGS_Order_Detail_DataViewOrderHed_GS_EditComplete_cEquals_False = new RowRule("GS_Order_Detail_DataView.OrderHed_GS_EditComplete_c", RuleCondition.Equals, false, new RowRuleActionDelegate2(this.GS_Order_Detail_DataViewOrderHed_GS_EditComplete_cEqualsFalse_CustomRuleAction), contextObject);
((EpiDataView)(this.oTrans.EpiDataViews["GS_Order_Detail_DataView"])).AddRowRule(rrCreateRowRuleGS_Order_Detail_DataViewOrderHed_GS_EditComplete_cEquals_False);
// **** end autogenerated code ****
}
private void GS_Order_Detail_DataViewOrderHed_GS_EditComplete_cEqualsFalse_CustomRuleAction(Ice.Lib.ExtendedProps.RowRuleDelegateArgs args)
{
// ** RowRuleDelegateArgs Properties: args.Arg1, args.Arg2, args.Context, args.Row
// ** put custom Rule Action logic here
//MessageBox.Show("Only Edit Complete False");
if(tbOrderChecklistTrueFalse.Text == "False" && tbOrderEditComplete.Text == "False")
{
MessageBox.Show("Checklist and EditComplete are False");
gbHidePricing.Visible = true;
}
else
{
MessageBox.Show("Checklist and EditComplete are not Complete");
gbHidePricing.Visible = true;
}
}
Shannon, Your code is configured using an Action Delegate but what you need is a standard Action with a Condition Delegate.
Go into the Rule Wizard Sheet and create a new Rule.
Rule Description: Whatever
Rule View: Your Order Detail View
Select View: Your Order Detail View
Select Field: Your Edit Complete column name
Rule Condition: CustomCondition (This will create a Condition Delegate)
Rule Value: True
Add to Conditions.
Create standard Rule Action to Hide the Pricing.
Add to Actions.
Update Code.
Go to the Script Editor and you will see where the code was created for a Condition Delegate. You will need to code both conditions in the delegate and then set the return value to True or False. If set True, the Action will occur.
Hi Guys, its it possible one rule to rule them all? I am trying to set a color for a particular condition base on two fields but I want that my method works for every view in my dashboard. Do you know a way to do this?
Thanks a lot here is my code.
private bool ValidateSDRevisionReason(object arg1,object arg2)
{
if (arg1 !=null && arg2 !=null)
{
arg1.ToString();
arg2.ToString();
}
return false;
}
private void CreateRowRuleV_AXIS_SOShopDrawingUpd_1View1_SDRevision_Reason_Electrical()
{
ControlSettings customColorSetting = new ControlSettings();
customColorSetting.BackColor = System.Drawing.Color.Orange;
// Description: Electrical1
// **** begin autogenerated code ****
object contextObject = null;
RuleAction errorV_AXIS_SOShopDrawingUpd_1View1_RowAction = RuleAction.AddRowSettings(this.oTrans, "V_AXIS_SOShopDrawingUpd_1View1", false, customColorSetting);
RuleAction[] ruleActions = new RuleAction[] {
errorV_AXIS_SOShopDrawingUpd_1View1_RowAction};
// Create RowRule and add to the EpiDataView.
RowRule rrCreateRowRuleV_AXIS_SOShopDrawingUpd_1View1OrderDtl_ShortChar10Equals_080 = new RowRule(null, UserNotAllowedToJobClosed, contextObject, ruleActions);
((EpiDataView)(this.oTrans.EpiDataViews["V_AXIS_SOShopDrawingUpd_1View1"])).AddRowRule(rrCreateRowRuleV_AXIS_SOShopDrawingUpd_1View1OrderDtl_ShortChar10Equals_080);
// **** end autogenerated code ****
}