RulePhrase Data output format to third party application Question

Hello Decisions,

I'm using Rulephrases and I've got an issue. When I set up a rule, I'd like to output the data to my third part application as JSON, however the output is sent out in the incorrect order, the output is sorted by the rulephrase ID rather than the order in which they are evaluated. Is there anything I can use to accomplish this so that I wouldn't have to go inside of the rules every time I want to see what's being evaluated, as well as sending the output through in the correct order/format?

Comments

  • Hey there, thanks for using the Decisions Community Forum!


    You can utilize the 'Open Rule For Editing' and 'Get Step Display Data' steps to achieve these results!. You can send the output of this information as JSON and feed it into your third party application. in the output there will be a few step types, which are as follows:

    Step type 0 = The Phrase in the rule 

    Step type 1 = 'AND' Grouping 

    Step type 2 = 'Either/Or' Grouping

    Here's a screenshot showing the Rule:

    Here's the output of this rule in JSON format:

    [

    {

    "ParentId":"",

    "Id":"Root",

    "StepType":1

    },

    {

    "ParentId":"Root",

    "Id":"Statement1",

    "StepType":0,

    "Anchor":"[Age]",

    "Verb":"GreaterThan",

    "Value":18

    },

    {

    "ParentId":"Root",

    "Id":"EitherOrGroup",

    "StepType":2

    },

    {

    "ParentId":"EitherOrGroup"

    "Id":"Either"

    "StepType":1

    },

    {

    "ParentId":"EitherOrGroup",

    "Id":"Or",

    "StepType":1

    },

    {

    "ParentId":"Either",

    "Id":"Statement2",

    "StepType":0,

    "Anchor":"[Name]",

    "Verb":"Equals",

    "Value":"Bob"

    },

    {

    "ParentId":"Or",

    "Id":"Statement3",

    "StepType":0,

    "Anchor":"[Name]",

    "Verb":"Equals",

    "Value":"Bill"

    }

    ]

    We hope this helps!

    Regards,

    Levi | Decisions Support

Sign In or Register to comment.