Created
December 12, 2012 12:05
-
-
Save anonymous/4267272 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is the data being used inside the rule. This can come from anywhere. | |
| { | |
| averagePriceSold: "12.10", | |
| numberOfVisitors: 1000 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is a (Pseudo code) function being called from inside the rule, when all rules evaluate to TRUE. | |
| saveValue: function(data) { | |
| sendEmail("Value too low", data); | |
| Dashboard.add.warning("Value too low"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| singleRule = { | |
| conditions: { | |
| all: // All validations should pass like AND (other value is 'Any', like OR ) | |
| [ | |
| { | |
| name: "averagePriceSold", // Parameter to check | |
| operator: "lessThan", // Operator | |
| value: "15.15" // Value | |
| }, | |
| { | |
| name: "numberOfVisitors", | |
| operator: "higherThan", | |
| value: "1100" | |
| } | |
| ]}, | |
| actions: [ | |
| { | |
| name: "price", // Action Name | |
| value: "saveValue", // Action to perform (is a function) | |
| fields: [ | |
| { | |
| name: "averageSalesPrice", // Pass these fields to the action (Function arguments) | |
| value: "too low" | |
| } | |
| ] | |
| }] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment