Select to view content in your preferred language

Relationship inspector that edits a related table?

805
3
12-09-2013 12:15 PM
ionarade_lima
Emerging Contributor
Does anybody have a working example of an relationship inspector that edits a related table?

This example, I can't see any fields, because it says there are no related records

https://developers.arcgis.com/en/flex/sample-code/relationship-inspector-editing.htm
Tags (2)
0 Kudos
3 Replies
ionarawilson1
Deactivated User
After I published a feature service with features that have related records I can see the attributes and the add new record button.
0 Kudos
YueWu1
by Esri Regular Contributor
Esri Regular Contributor
I looked into this and it appears that the relationship inspector will allow you to edit to the related record in a table if there is a related record.

You can create a feature through the REST API by using this JSON:

Here is the URL:
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/1...

Here is the syntax:

[
  {
    "attributes" : {
      "sf_311_serviceoid" : 9423833
    }
  }
]

Are you looking for an enhancement to this relationship inspector?  If so please let me know how your thoughts on how you think this should work.

I can reach out to the team for you or maybe we can get someone from the team to chime in here.
0 Kudos
ionarawilson1
Deactivated User
Hi Nathan,

I actually got it working. The only thing I really need is to have a button that goes to the last related record in the relationship inspector so the user does not need to click on one by one to get to the last. Would this be possible. I got a hold of the skin for the Relationship Inspector  and for the relationship inspector attribute inspector skin and I see it is using a previous record button and next record button but there is not a last record button. Would it be possible to create a button with a function that sends the user to the last record? thank you!

Here is the code where I think I could put another button to go to the last record, but I don't know how to code what goes inside the function to go to the last record


<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (c) 2012 ESRI

    All rights reserved under the copyright laws of the United States
    and applicable international laws, treaties, and conventions.

    You may freely redistribute and use this sample code, with or
    without modification, provided you include the original copyright
    notice and use restrictions.

    See use restrictions in use_restrictions.txt.
-->
<!---
    The default skin class for the RelationshipInspector component.
    <p><b>Since:</b> ArcGIS API 3.1 for Flex</p>
-->
<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark"
             xmlns:mx="library://ns.adobe.com/flex/mx"
             xmlns:esri="http://www.esri.com/2008/ags">

    <!-- host component -->
    <fx:Metadata>
        /**
         * A strongly typed property that references the component to which this skin is applied.
         */
        [HostComponent("com.esri.ags.components.RelationshipInspector")]
    </fx:Metadata>

    <fx:Script>
        <![CDATA[
            import mx.events.EffectEvent;

            [Bindable]
            [Embed(source="S:/Sustainable Forestry/Iwilson/FEATURE_TABLE/src/assets/skins/loader.swf")]
            private var loader:Class;

            /* Define the symbol fill items that should be colored by the "symbolColor" style.*/
            private static const symbols:Array = [ "borderLineSymbol" ];

            /**
             * @private
             */
            override public function get symbolItems():Array
            {
                return symbols;
            }

            private function fade_effectEndHandler(event:EffectEvent):void
            {
                editOperationCompleteLabel.includeInLayout = false;
            }
        ]]>
    </fx:Script>

    <s:states>
        <s:State name="normal"/>
        <s:State name="disabled"/>
        <s:State name="queryRelatedRecords"/>
        <s:State name="addingNewRecord"/>
        <s:State name="noRelationships"/>
        <s:State name="noRelatedRecords"/>
    </s:states>

    <fx:Declarations>
        <s:Fade id="fade"
                alphaFrom="1"
                alphaTo="0"
                duration="1000"
                effectEnd="fade_effectEndHandler(event)"/>
        <fx:Component id="relationshipButton">
            <s:ToggleButton/>
        </fx:Component>
    </fx:Declarations>

    <s:Rect left="0" right="0" top="0" bottom="0"
            radiusX="5"
            radiusY="5">
        <s:stroke>
            <s:SolidColorStroke id="borderLineSymbol"
                                color="black"
                                weight="1"/>
        </s:stroke>
    </s:Rect>

    <!--- @private -->
    <mx:SWFLoader horizontalAlign="center"
                  horizontalCenter="0"
                  includeIn="queryRelatedRecords"
                  source="{loader}"
                  verticalCenter="0"/>

    <!--- @private -->
    <s:Label horizontalCenter="0"
             includeIn="noRelationships"
             text="{resourceManager.getString('ESRIMessages', 'relationshipInspectorNoRelationships')}"
             verticalCenter="0"/>

    <!--- @private -->
    <s:Label horizontalCenter="0"
             includeIn="noRelatedRecords"
             text="{resourceManager.getString('ESRIMessages', 'relationshipInspectorNoRelatedRecords')}"
             verticalCenter="0"/>

    <s:VGroup width="100%" height="100%"
              left="5" right="5" top="5" bottom="15"
              excludeFrom="noRelationships"
              horizontalAlign="right">
        <s:Scroller width="100%" verticalScrollPolicy="off">
            <s:HGroup id="relationshipButtonsGroup"
                      width="100%"
                      includeInLayout="false"
                      paddingBottom="5"
                      visible="false"/>
        </s:Scroller>
        <s:Button id="addRecordButton"
                  buttonMode="true"
                  excludeFrom="noRelationships,addingNewRecord"
                  includeInLayout="false"
      
                  label="{resourceManager.getString('ESRIMessages', 'relationshipInspectorAddRecord')}"
                  visible="false"/>
        <esri:AttributeInspector id="attributeInspector"
                                 width="100%" height="100%"
                                 deleteButtonLabel.addingNewRecord="{resourceManager.getString('ESRIMessages', 'relationshipInspectorCancel')}"
                                 excludeFrom="queryRelatedRecords,noRelationships,noRelatedRecords"
                                 okButtonLabel.addingNewRecord="{resourceManager.getString('ESRIMessages', 'relationshipInspectorAdd')}"
                                 okButtonVisible="{hostComponent.editEnabled &amp;&amp; hostComponent.featureLayer.isEditable}"
                                 updateEnabled="{hostComponent.editEnabled &amp;&amp; hostComponent.featureLayer.isEditable}"/>
    </s:VGroup>
    <s:HGroup id="editOperationStartGroup"
              width="100%"
              left="5" bottom="2"
              includeInLayout="false"
              verticalAlign="middle"
              visible="false">
        <mx:SWFLoader source="{loader}"/>
        <!--- Label shown when operation starts. -->
        <s:Label id="editOperationStartLabel" width="100%"/>
    </s:HGroup>
    <!--- Label shown when operation completes. -->
    <s:Label id="editOperationCompleteLabel"
             width="100%"
             left="5" bottom="2"
             hideEffect="{fade}"
             includeInLayout="false"
             visible="false"/>

</s:SparkSkin>


0 Kudos