Identify related tables

1684
1
Jump to solution
09-25-2012 09:53 AM
TanyaOwens
Occasional Contributor III
Hello - so I feel a bit lost. I am trying to set up an identify that passes through to a related table query and shows the results in a datagrid. I stumped on several parts of that (Note I have little experience with programming). I am currently using SL 4 API 2.4. My layer is somewhat complex - it is related to two sql tables with one of those tables relate to two additional tables.

I found this thread http://forums.arcgis.com/threads/18535-Does-the-identity-button-show-related-tables?highlight=relate... that was somewhat helpful but really don't understand how to go about getting the object id returned by the identify and to use that in the query of the related table. (Also note that I need to query on a different field to match up to the other related table (loc_Id).

I also am trying to use the sample for query related tables http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryRelatedRecords but I am completely confused by it.
  private void SelectedWellsTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)         {             if (e.OldValue != null)             {                 Graphic g = e.OldValue as Graphic;                 g.UnSelect();                 g.SetZIndex(0);             }              if (e.NewValue != null)             {                 Graphic g = e.NewValue as Graphic;                 g.Select();                 g.SetZIndex(1);                  //Relationship query                 RelationshipParameter relationshipParameters = new RelationshipParameter()                 {                     ObjectIds = new int[] { Convert.ToInt32(g.Attributes[SelectedWellsTreeView.Tag as string]) },                    //HOW DO YOU SET UP THE .TAG                     OutFields = new string[] { "loc_id, count_id, _year, adt" },                     RelationshipId = 3, //WHAT IS THE RELATIONSHIP ID                     OutSpatialReference = Map.SpatialReference                 };                  queryTask.ExecuteRelationshipQueryAsync(relationshipParameters);             }         }


What I really am looking for is an example of of getting a specific field from identify and how to pass it to the query. Does any one have or know of any code sample they would be willing to share. Anything to point me it the right direction would be greatly appreciated.

Thanks!
0 Kudos
1 Solution

Accepted Solutions
TanyaOwens
Occasional Contributor III
I think I got it working with the sample data - after figuring out about the Relationship ID being the related table number it seems to be working.

View solution in original post

0 Kudos
1 Reply
TanyaOwens
Occasional Contributor III
I think I got it working with the sample data - after figuring out about the Relationship ID being the related table number it seems to be working.
0 Kudos