Skip to content

Commit

Permalink
Added link-entity type in treeview builder Closing #1034
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Apr 23, 2024
1 parent 4154c9b commit 7b037c7
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions FetchXmlBuilder/Builder/TreeNodeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ public static void SetNodeText(TreeNode node, FetchXmlBuilder fxb, bool validate
var agg = node.Value("aggregate");
var name = node.Value("name");
var alias = node.Value("alias");
if (string.IsNullOrWhiteSpace(alias))
{
alias = null;
}
switch (node.Name)
{
case "fetch":
Expand Down Expand Up @@ -149,11 +153,22 @@ public static void SetNodeText(TreeNode node, FetchXmlBuilder fxb, bool validate
break;

case "entity":
case "link-entity":
text += " " + fxb.GetEntityDisplayName(name);
if (!string.IsNullOrEmpty(alias))
break;

case "link-entity":
var dispname = fxb.GetEntityDisplayName(name);
if (!string.IsNullOrEmpty(alias) && !alias.ToLowerInvariant().Equals(dispname.ToLowerInvariant()))
{
text += " (" + alias + ")";
text += $" {alias} ({dispname})";
}
else
{
text += $" {alias ?? dispname}";
}
if (node.Value("link-type") is string linktype && !string.IsNullOrEmpty(linktype))
{
text += $" ({linktype})";
}
if (node.Value("intersect") == "true")
{
Expand All @@ -179,13 +194,9 @@ public static void SetNodeText(TreeNode node, FetchXmlBuilder fxb, bool validate
}
text += agg + "(" + name + ")";
}
else if (!string.IsNullOrEmpty(alias))
{
text += alias + " (" + name + ")";
}
else
{
text += name;
text += alias ?? name;
}
var grp = node.Value("groupby");
if (grp == "true")
Expand Down

0 comments on commit 7b037c7

Please sign in to comment.