Select to view content in your preferred language

Using Related Tables in Flex Viewer

5302
23
Jump to solution
05-31-2012 12:09 PM
AmySadler
Deactivated User
Hello! I am fairly new to using ArcGIS for Flex and am trying to set up a viewer for my organization. I am wanting to use the Query widget to allow users to search for information on a table. The table is related back to a layer and I can see it on my server, but when I go to use the data in the widget, I get error #1009. Is it possible to use a table in the query widget or does it have to be a feature class?

On a related note, can you use information in a related table to populate a "pop-up" for a feature?

Thanks very much for your help!
Amy S.
Tags (2)
0 Kudos
23 Replies
RobertScheitlin__GISP
MVP Emeritus
Joseph,

   I don't think that is even possible in ArcMap... No this is not a capability of the eSearch and is unlike to be added based on the complexity of the task. Think about what would have to happen if there was a one to many relate of one record with thousands of related records to just that one result....
0 Kudos
JosephAccardi
Regular Contributor
No problem Robert. The way you do it in ArcMap is if your feature class and related table are saved in a geodatabase you can perform a 1:M join. A join within a geodatabase will populate all matching records (not just the first matching record). From there you can export out the feature class to append the related attributes. (http://resources.arcgis.com/en/help/main/10.1/index.html#//005s0000002n000000).

Thanks,
Joe
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Joe,

  OK, that make sense. Joins and Relates are two different animals.
0 Kudos
MichaelVolz
Esteemed Contributor
Robert:

Can you use a mapservice with a datasource that uses a Query Layer to a SQL Server database table with your eSearch widget? I would like to be able to access related records that have been enabled from the Query Layer?

If this is possible, what version of your widget and/or the FlexViewer software would be needed?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Michael,

  I can not say that I have tested Query Layers in the eSearch widget. Give it a go and let me know the results.
0 Kudos
MichaelVolz
Esteemed Contributor
Robert:

I first tried to make configuration changes that would allow me to with related record information in the datagrid for a Query Layer, but that did not return any records.

I then made configuration changes just to use a standard ArcMap relate and that also did not return any records.

Does the related records mean you can access records from a relate created in ArcMap?  Or does it mean something else?

Can you explain how the configuration file should be modified so the related records get populated?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Michael,

   The relate has to be accessible for the REST Service directory. So when you publish a mxd that has a relate in ArcMap or a real relationship class in a geodatabase that relate gets exposed in the REST Service directory. There are examples of relates in the eSearchWidget.xml that come with the eSearch download.
0 Kudos
MichaelVolz
Esteemed Contributor
How would I be able to tell from the REST page that the relate is accessible from ArcGIS Server?

Can you pinpoint where in the documentation I would find more information about accessing related records?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Michael,

   You can see if a relate is available when you go to the REST Service directory for your map service layer and scroll down to the bottom. It would look something like this:


Relationships:

    calhoun.COUNTY.A_Bridge (0) -- Related To: ABIMS Bridges (0)
    calhoun.COUNTY.ADT (1) -- Related To: Average Daily Traffic (1)
    calhoun.COUNTY.Rail_Cross (2) -- Related To: Railroad Crossings (2)
    calhoun.COUNTY.Signs (3) -- Related To: Road Signs (3)
    calhoun.COUNTY.Guardrail (4) -- Related To: Guardrails (4)

Supported Interfaces:   REST

Supported Operations:   Query   Query Related Records

As far as documentation for using relates in my widget that would be covered in the Enhanced Search Widget XML Configuration.pdf page 5.
0 Kudos
MichaelVolz
Esteemed Contributor
Robert:

Thank you for the additional information, but the related records portion of the datagrid is still not getting populated.

When I first accessed the REST services the relationship did not show up even though a relationship existed on the layer.  The layer was created from a lyr file and when the lyr file is brought into an mxd, the related tables do not automatically appear.  I needed to open the table view and then use the Related Tables button on the toolbar to bring in the related tables.  I then had to stop and start the mapservice and refresh the REST cache.

Do I need to add table information for the related table in the config file below the layers definition area?  I did not add table information below the layers area as I thought the fields all="true" would populate the related record portion of the datagrid.
0 Kudos