Hi,
is there a way to determine which tables are joined to a feature layer using the ArcGIS Pro SDK for .NET?
For example, I have a Feature Layer "Trees" joined to a Table "Trees_Metadata". I performed the join using the "Joins and Relates" => "Add Join..." function. How can I use the ArcGIS Pro SDK for .NET to find out retrospectively which table the "Trees" layer is joined to?
Thanks in advance
Solved! Go to Solution.
Hi,
You need to start from FeatureLayer or StandaloneTable to get origin or joined table.
protected override async void OnClick()
{
var map = MapView.Active.Map;
if (map == null || map.Layers.Count == 0)
{
MessageBox.Show("No layers found in the map.");
return;
}
var bfl = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(layer => layer.Name.Equals("your layer name"));
if(bfl.HasJoins)
{
await QueuedTask.Run(() => {
var table1 = bfl.GetTable().GetJoin().GetOriginTable();
var table2 = bfl.GetTable().GetJoin().GetJoinedTable();
// your code here
});
}
}
I've already tried to determine the joined table using FeatureClass.GetJoin(). I get the following exception:
System.InvalidOperationException: "'Trees' is not a joined table."
'Baumgruppen' is not a joined table.
at ArcGIS.Core.Data.Table.GetJoin()
FeatureClass.IsJoinedTable() also returns false, even though I created a join as mentioned above.
Hi,
You need to start from FeatureLayer or StandaloneTable to get origin or joined table.
protected override async void OnClick()
{
var map = MapView.Active.Map;
if (map == null || map.Layers.Count == 0)
{
MessageBox.Show("No layers found in the map.");
return;
}
var bfl = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(layer => layer.Name.Equals("your layer name"));
if(bfl.HasJoins)
{
await QueuedTask.Run(() => {
var table1 = bfl.GetTable().GetJoin().GetOriginTable();
var table2 = bfl.GetTable().GetJoin().GetJoinedTable();
// your code here
});
}
}
This example helped me a lot. Thanks.