Replies: 1 comment
-
I think that during the object journey through the function some serialization settings could be missed, a had the same issue with the nullable decimals and solved it in two ways: explicit convertation - |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @abbasc52
First, thank you for sharing this outstanding tool.
I have created an Azure function
namespace HttpRuleFunction
{
public static class HttpRuleFunction {
[FunctionName("HttpRuleFunction")]
public static async Task Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
}
The http request body is
{"country" : "india",
"loyaltyFactor" : 5}
Also, I have simplified the Discount.json
[
{
"WorkflowName": "Discount",
"Rules": [
{
"RuleName": "GiveDiscount10",
"SuccessEvent": "10",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "propertyExpando.country == "india" AND propertyExpando.loyaltyFactor <= 2"
},
{
"RuleName": "GiveDiscount20",
"SuccessEvent": "20",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "propertyExpando.country == "india" AND propertyExpando.loyaltyFactor == 3"
},
{
"RuleName": "GiveDiscount25",
"SuccessEvent": "25",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "propertyExpando.country == "india" AND propertyExpando.loyaltyFactor == 5"
}
]
}
]
But in the ResultSet, I am getting exception
exceptionMessage "Exception while parsing expression
propertyExpando.country == \"india\" AND propertyExpando.loyaltyFactor <= 2
- The binary operator LessThanOrEqual is not defined for the types 'System.Object' and 'System.Int32'."If I run default program passing var basicInfo = "{"country": "india","loyaltyFactor": 5}"; it works fine.
Not sure why it is not accepting my JSON. Any help is appreciated
Thanks
Beta Was this translation helpful? Give feedback.
All reactions