Skip to content

Commit

Permalink
Adding validation warning about contains operator #708
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed May 28, 2022
1 parent f103d94 commit 87200cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions FetchXmlBuilder/AppCode/Validations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ private static ControlValidationResult ValidateCondition(TreeNode node, FetchXml
{
return new ControlValidationResult(ControlValidationLevel.Warning, "Attribute must be included.");
}
var oper = node.Value("operator");
if (oper == "contains" || oper == "does-not-contain")
{
return new ControlValidationResult(ControlValidationLevel.Error, $"Condition operator '{oper}' is not supported by FetchXml.", "https://docs.microsoft.com/en-us/power-apps/developer/data-platform/fetchxml-schema");
}
var entityname = node.Value("entityname");
if (!string.IsNullOrWhiteSpace(entityname) && !node.LocalEntityIsRoot())
{
Expand Down
2 changes: 1 addition & 1 deletion FetchXmlBuilder/Controls/conditionControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected override ControlValidationResult ValidateControl(Control control)

if (control == cmbOperator && cmbOperator.SelectedItem is OperatorItem opercon && (opercon.GetValue() == "contains" || opercon.GetValue() == "does-not-contain"))
{
return new ControlValidationResult(ControlValidationLevel.Error, "Contains (and not) are available, but not supported for FetchXml.",
return new ControlValidationResult(ControlValidationLevel.Warning, "Contains (and not) are available, but not supported for FetchXml.",
"https://docs.microsoft.com/en-us/power-apps/developer/data-platform/fetchxml-schema#:~:text=%3Cxs%3AsimpleType%20name%3D%22operator%22%3E");
}

Expand Down

0 comments on commit 87200cd

Please sign in to comment.