Problem with rule validation - valid on save, invalid on load





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















While testing the unchanged CodeEffects asp.net core demo application (Editor 5.0.4.8, Engine 5.0.2.6) I've found an interesting problem.



If I create an execution rule that checks for example if FirstName contains two spaces, I can save this rule without a problem, and in SaveRule action it passes the validation using editor.Rule.IsValid. Here is an example of the rule definition:



        <if>
<clause>
<condition type="contains" stringComparison="OrdinalIgnoreCase">
<property name="FirstName" />
<value> </value>
</condition>
</clause>
<then>
<method name="Register">
<value>aaaa</value>
</method>
</then>
</if>


But when refreshing the editor and trying to load this saved rule it won't load into editor. The reason is that the LoadRule controller action returns empty json.



While investigating this further it looks that the editor.GetClientRuleData returns null because the rule is invalid. If I check editor.Rule.IsValid just before calling editor.GetClientRuleData I can see it return false and the editor.Rule.InvalidElements holds one element:



{{c:"",h:"v120"}}


The error message would be "The only allowed operators for empty string values are IS and IS NOT" but of course it's not shown in the editor in the demo project as this is not expected to happen.



Not sure if this is in any way related to the problem, but one obvious difference between LoadRule and SaveRule actions is how the rule is loaded.



When saving the rule, the rule data (coming from the UI) is loaded into editor with



editor.LoadClientData(data.Data);


and when loading the rule it's loaded using the xml (from the storage) effectively calling this:



editor.Rule = Rule.Models.RuleModel.Create(ruleXml, typeof(Models.Patient))


So my question is why can invalid rule pass the validation on save, and then the same rule fails the validation on load? Any fix I can try or a workaround?










share|improve this question























  • Thanks. We are checking this issue.

    – Alex
    Nov 23 '18 at 17:06


















1















While testing the unchanged CodeEffects asp.net core demo application (Editor 5.0.4.8, Engine 5.0.2.6) I've found an interesting problem.



If I create an execution rule that checks for example if FirstName contains two spaces, I can save this rule without a problem, and in SaveRule action it passes the validation using editor.Rule.IsValid. Here is an example of the rule definition:



        <if>
<clause>
<condition type="contains" stringComparison="OrdinalIgnoreCase">
<property name="FirstName" />
<value> </value>
</condition>
</clause>
<then>
<method name="Register">
<value>aaaa</value>
</method>
</then>
</if>


But when refreshing the editor and trying to load this saved rule it won't load into editor. The reason is that the LoadRule controller action returns empty json.



While investigating this further it looks that the editor.GetClientRuleData returns null because the rule is invalid. If I check editor.Rule.IsValid just before calling editor.GetClientRuleData I can see it return false and the editor.Rule.InvalidElements holds one element:



{{c:"",h:"v120"}}


The error message would be "The only allowed operators for empty string values are IS and IS NOT" but of course it's not shown in the editor in the demo project as this is not expected to happen.



Not sure if this is in any way related to the problem, but one obvious difference between LoadRule and SaveRule actions is how the rule is loaded.



When saving the rule, the rule data (coming from the UI) is loaded into editor with



editor.LoadClientData(data.Data);


and when loading the rule it's loaded using the xml (from the storage) effectively calling this:



editor.Rule = Rule.Models.RuleModel.Create(ruleXml, typeof(Models.Patient))


So my question is why can invalid rule pass the validation on save, and then the same rule fails the validation on load? Any fix I can try or a workaround?










share|improve this question























  • Thanks. We are checking this issue.

    – Alex
    Nov 23 '18 at 17:06














1












1








1








While testing the unchanged CodeEffects asp.net core demo application (Editor 5.0.4.8, Engine 5.0.2.6) I've found an interesting problem.



If I create an execution rule that checks for example if FirstName contains two spaces, I can save this rule without a problem, and in SaveRule action it passes the validation using editor.Rule.IsValid. Here is an example of the rule definition:



        <if>
<clause>
<condition type="contains" stringComparison="OrdinalIgnoreCase">
<property name="FirstName" />
<value> </value>
</condition>
</clause>
<then>
<method name="Register">
<value>aaaa</value>
</method>
</then>
</if>


But when refreshing the editor and trying to load this saved rule it won't load into editor. The reason is that the LoadRule controller action returns empty json.



While investigating this further it looks that the editor.GetClientRuleData returns null because the rule is invalid. If I check editor.Rule.IsValid just before calling editor.GetClientRuleData I can see it return false and the editor.Rule.InvalidElements holds one element:



{{c:"",h:"v120"}}


The error message would be "The only allowed operators for empty string values are IS and IS NOT" but of course it's not shown in the editor in the demo project as this is not expected to happen.



Not sure if this is in any way related to the problem, but one obvious difference between LoadRule and SaveRule actions is how the rule is loaded.



When saving the rule, the rule data (coming from the UI) is loaded into editor with



editor.LoadClientData(data.Data);


and when loading the rule it's loaded using the xml (from the storage) effectively calling this:



editor.Rule = Rule.Models.RuleModel.Create(ruleXml, typeof(Models.Patient))


So my question is why can invalid rule pass the validation on save, and then the same rule fails the validation on load? Any fix I can try or a workaround?










share|improve this question














While testing the unchanged CodeEffects asp.net core demo application (Editor 5.0.4.8, Engine 5.0.2.6) I've found an interesting problem.



If I create an execution rule that checks for example if FirstName contains two spaces, I can save this rule without a problem, and in SaveRule action it passes the validation using editor.Rule.IsValid. Here is an example of the rule definition:



        <if>
<clause>
<condition type="contains" stringComparison="OrdinalIgnoreCase">
<property name="FirstName" />
<value> </value>
</condition>
</clause>
<then>
<method name="Register">
<value>aaaa</value>
</method>
</then>
</if>


But when refreshing the editor and trying to load this saved rule it won't load into editor. The reason is that the LoadRule controller action returns empty json.



While investigating this further it looks that the editor.GetClientRuleData returns null because the rule is invalid. If I check editor.Rule.IsValid just before calling editor.GetClientRuleData I can see it return false and the editor.Rule.InvalidElements holds one element:



{{c:"",h:"v120"}}


The error message would be "The only allowed operators for empty string values are IS and IS NOT" but of course it's not shown in the editor in the demo project as this is not expected to happen.



Not sure if this is in any way related to the problem, but one obvious difference between LoadRule and SaveRule actions is how the rule is loaded.



When saving the rule, the rule data (coming from the UI) is loaded into editor with



editor.LoadClientData(data.Data);


and when loading the rule it's loaded using the xml (from the storage) effectively calling this:



editor.Rule = Rule.Models.RuleModel.Create(ruleXml, typeof(Models.Patient))


So my question is why can invalid rule pass the validation on save, and then the same rule fails the validation on load? Any fix I can try or a workaround?







rule-engine business-rules codeeffects






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 14:33









peterrpeterr

715




715













  • Thanks. We are checking this issue.

    – Alex
    Nov 23 '18 at 17:06



















  • Thanks. We are checking this issue.

    – Alex
    Nov 23 '18 at 17:06

















Thanks. We are checking this issue.

– Alex
Nov 23 '18 at 17:06





Thanks. We are checking this issue.

– Alex
Nov 23 '18 at 17:06












1 Answer
1






active

oldest

votes


















0














This issue has been fixed in the latest version of Rule Editor. You need to update Code Effects references from NuGet:



CodeEffects.Rule.Common - 5.0.2.4, CodeEffects.Rule.Editor.Core - 5.0.4.1 (this is the assembly that contains that fix), CodeEffects.Rule.Editor.Web.Core - 5.0.4.8






share|improve this answer
























  • I've checked and I already have this versions, nothing to update from NuGet. CodeEffects.Rule.Editor.Web.Core - 5.0.4.8 and this one has dependeny on CodeEffects.Rule.Editor.Core - 5.0.4.1. The problem was found with this versions.

    – peterr
    Nov 24 '18 at 22:43













  • Please email us at public.support@codeeffects.com. We'll continue from there.

    – Alex
    Nov 26 '18 at 12:56












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448578%2fproblem-with-rule-validation-valid-on-save-invalid-on-load%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














This issue has been fixed in the latest version of Rule Editor. You need to update Code Effects references from NuGet:



CodeEffects.Rule.Common - 5.0.2.4, CodeEffects.Rule.Editor.Core - 5.0.4.1 (this is the assembly that contains that fix), CodeEffects.Rule.Editor.Web.Core - 5.0.4.8






share|improve this answer
























  • I've checked and I already have this versions, nothing to update from NuGet. CodeEffects.Rule.Editor.Web.Core - 5.0.4.8 and this one has dependeny on CodeEffects.Rule.Editor.Core - 5.0.4.1. The problem was found with this versions.

    – peterr
    Nov 24 '18 at 22:43













  • Please email us at public.support@codeeffects.com. We'll continue from there.

    – Alex
    Nov 26 '18 at 12:56
















0














This issue has been fixed in the latest version of Rule Editor. You need to update Code Effects references from NuGet:



CodeEffects.Rule.Common - 5.0.2.4, CodeEffects.Rule.Editor.Core - 5.0.4.1 (this is the assembly that contains that fix), CodeEffects.Rule.Editor.Web.Core - 5.0.4.8






share|improve this answer
























  • I've checked and I already have this versions, nothing to update from NuGet. CodeEffects.Rule.Editor.Web.Core - 5.0.4.8 and this one has dependeny on CodeEffects.Rule.Editor.Core - 5.0.4.1. The problem was found with this versions.

    – peterr
    Nov 24 '18 at 22:43













  • Please email us at public.support@codeeffects.com. We'll continue from there.

    – Alex
    Nov 26 '18 at 12:56














0












0








0







This issue has been fixed in the latest version of Rule Editor. You need to update Code Effects references from NuGet:



CodeEffects.Rule.Common - 5.0.2.4, CodeEffects.Rule.Editor.Core - 5.0.4.1 (this is the assembly that contains that fix), CodeEffects.Rule.Editor.Web.Core - 5.0.4.8






share|improve this answer













This issue has been fixed in the latest version of Rule Editor. You need to update Code Effects references from NuGet:



CodeEffects.Rule.Common - 5.0.2.4, CodeEffects.Rule.Editor.Core - 5.0.4.1 (this is the assembly that contains that fix), CodeEffects.Rule.Editor.Web.Core - 5.0.4.8







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 24 '18 at 12:47









AlexAlex

182112




182112













  • I've checked and I already have this versions, nothing to update from NuGet. CodeEffects.Rule.Editor.Web.Core - 5.0.4.8 and this one has dependeny on CodeEffects.Rule.Editor.Core - 5.0.4.1. The problem was found with this versions.

    – peterr
    Nov 24 '18 at 22:43













  • Please email us at public.support@codeeffects.com. We'll continue from there.

    – Alex
    Nov 26 '18 at 12:56



















  • I've checked and I already have this versions, nothing to update from NuGet. CodeEffects.Rule.Editor.Web.Core - 5.0.4.8 and this one has dependeny on CodeEffects.Rule.Editor.Core - 5.0.4.1. The problem was found with this versions.

    – peterr
    Nov 24 '18 at 22:43













  • Please email us at public.support@codeeffects.com. We'll continue from there.

    – Alex
    Nov 26 '18 at 12:56

















I've checked and I already have this versions, nothing to update from NuGet. CodeEffects.Rule.Editor.Web.Core - 5.0.4.8 and this one has dependeny on CodeEffects.Rule.Editor.Core - 5.0.4.1. The problem was found with this versions.

– peterr
Nov 24 '18 at 22:43







I've checked and I already have this versions, nothing to update from NuGet. CodeEffects.Rule.Editor.Web.Core - 5.0.4.8 and this one has dependeny on CodeEffects.Rule.Editor.Core - 5.0.4.1. The problem was found with this versions.

– peterr
Nov 24 '18 at 22:43















Please email us at public.support@codeeffects.com. We'll continue from there.

– Alex
Nov 26 '18 at 12:56





Please email us at public.support@codeeffects.com. We'll continue from there.

– Alex
Nov 26 '18 at 12:56




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448578%2fproblem-with-rule-validation-valid-on-save-invalid-on-load%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?