RulesEngine icon indicating copy to clipboard operation
RulesEngine copied to clipboard

Why excute actions after all rules are completed

Open lajiv opened this issue 3 years ago • 6 comments

What if the next rule use a value to a variable after running successfully using the previous rule。How should i do. If tempc + = 1 when the conditions of rule 1, 2 ,3 are true, and rule 4 judges according to the value of tempc,how to do this

lajiv avatar May 15 '22 05:05 lajiv

I have the same problem here. Is there any plan to change this or add this option?

MarcDrexler avatar May 27 '22 12:05 MarcDrexler

I have the same problem here. Is there any plan to change this or add this option? That's how I solved it:A set of rules is divided into multiple workflows,

lajiv avatar May 27 '22 13:05 lajiv

Hi @lajiv, can you provide a code example how you are planning to use actions one after another? If it fits the design, we can enable it

abbasc52 avatar May 30 '22 04:05 abbasc52

There was a similar ask earlier on an issue where they wanted to say a Rule is success if N child rules succeed, Here is the link to do it via custom actions -> https://dotnetfiddle.net/VyF7Xi Let me know if this is what you are looking for.

abbasc52 avatar May 30 '22 04:05 abbasc52

@abbasc52 Thanks for your reply.

{
    "WorkflowName": "Middle10",
    "Rules": [
        {
            "RuleName": "rule4",
            "Enabled": true,
            "ErrorType": 1,
            "Operator": "Or",
            "RuleExpressionType": 0,
            "Rules": [
                {
                    "RuleName": "rule4-3",
                    "Enabled": true,
                    "ErrorType": 1,
                    "RuleExpressionType": 0,
                    "Expression": "Math.Abs(input1.C1.EQU_CR-input1.C2.EQU_CR)<0.04",
                    "SuccessEvent": "1",
                    "Actions": {
                        "OnSuccess": {
                            "Name": "OutputExpression",
                            "Context": {
                                "name": "C1.Condition",
                                "Expression": "input1.C1.Condition + 1"
                            }
                        }
                    }
                },
                {
                    "RuleName": "rule4-4",
                    "Enabled": true,
                    "ErrorType": 1,
                    "RuleExpressionType": 0,
                    "Expression": "Math.Abs((input1.C1.AIM_P-input1.C2.AIM_P))<0.03",
                    "SuccessEvent": "1",
                    "Actions": {
                        "OnSuccess": {
                            "Name": "OutputExpression",
                            "Context": {
                                "name": "C1.Condition",
                                "Expression": "input1.C1.Condition + 1"
                            }
                        }
                    }
                },
                {
                    "RuleName": "rule5",
                    "Enabled": true,
                    "ErrorType": 1,
                    "RuleExpressionType": 0,
                    "Operator": "Or",
                    "Rules": [
                        {
                            "RuleName": "rule5-1",
                            "Enabled": true,
                            "ErrorType": 1,
                            "RuleExpressionType": 0,
                            "Expression": " input1.C1.Condition>=2",
                            "Actions": {
                                "OnSuccess": {
                                    "Name": "OutputExpression",
                                    "Context": {
                                        "name": "C1.result",
                                        "Expression": "\"TRUE\""
                                    }
                                }
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

The third rule condition is based on the the first two rules action.i have to split it to two workflow because it excute actions after all rules are completed

lajiv avatar Jun 13 '22 01:06 lajiv

Is this functionality actively being worked on as an enhancement? I'm running into this same issue.

AmySchaplowsky avatar Dec 14 '23 20:12 AmySchaplowsky