2

I am attempting to create drop down lists when editing attributes in Arcgis Desktop in order to eliminate human errors. Through using domains I managed to carry this out successfully and the drop down lists work well. However I have an application that caters for lookup tables and not domains, and in order to avoid having to modify both the lookup table and the domain I want to create drop down lists for attributes on Desktop using lookup tables with joins. Is there a way of doing this as I can't seem to carry this out successfully?

  • 1
    You can use subtypes to define different feature templates so when user will create new features they will need to choose a template that can have multiple pre-defined attributes. However, the drop-down list of legal values is available only through domains that you assign to fields. It's possible to build own logic for this using ArcObjects, but I doubt that this is an option for you. – Alex Tereshenkov Aug 17 '17 at 8:52
  • So there is no way of creating the drop down list for attribute values by linking a data table with an attribute within the layer table via joins? I will try out using feature templates however this would still mean if I have to do updates to the data table I would also have to update the feature template each time which is what I am trying to avoid. – Maeglin77 Aug 17 '17 at 10:36
  • Correct. You have to use domains. You shouldn't be afraid of updating your domains. You can keep your codes/values in a geodatabase table and then use GP tools to update your domains either manually or via Python scripting, it's fairly easy. – Alex Tereshenkov Aug 17 '17 at 10:56
0

I managed to carry this out successfully with the following process:

  • A data table was created within arcmap with an id field and a data field, while a foreign key was created in the layer attributes of the layer I wanted to attach the data table to.
  • This data table then had to be added to the map using the add data tool and only afterwards would the map and the layer be published together as a service. -In this way the relationship would actually be published as part of the service. -I then used this code to check the service for any relationships:

    //related tables
    var relatedQuery = new RelationshipQuery();
    relatedQuery.outFields = [dataTableDataField];
    relatedQuery.relationshipId = relationsId;
    relatedQuery.objectIds = [IDOfObjectBeingEdited];
    relatedTableResult = [];
    displayText = "";
    graphic._graphicsLayer.queryRelatedFeatures(relatedQuery, function (relatedRecords) {
    
    relatedTableResult = relatedRecords[graphicObjectId];
    //Code to map the related data to the editable attribute window and populate dropdown list with the retrieved data can then be placed here
    

    }

This allowed for dropdown lists based on the created relationships when editing the attributes of a feature on a particular layer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.