export field schema into tabular format (ArcPro)

2836
5
Jump to solution
07-24-2019 09:04 AM
MalcolmLittle
Regular Contributor

For the life of me, I cannot figure out how to export the field structure of a shapefile into something useable in Excel. For instance, I have a Waterloo streets shapefile, which I want to compare their fields to other municipality shapefiles:

I use ArcPro 2.4

0 Kudos
1 Solution

Accepted Solutions
LanceCole
MVP Regular Contributor

Malcolm‌, 

You can use the Export XML Workspace Document tool from Pro or Catalog, select as a Schema only and uncheck Metadata.  This file can then be opened using Excel.  Excel may ask if you want options, I normally use "As a XML table" and just click OK if you receive the message the source does not refer to a schema.

Export XML

View solution in original post

5 Replies
LanceCole
MVP Regular Contributor

Malcolm‌, 

You can use the Export XML Workspace Document tool from Pro or Catalog, select as a Schema only and uncheck Metadata.  This file can then be opened using Excel.  Excel may ask if you want options, I normally use "As a XML table" and just click OK if you receive the message the source does not refer to a schema.

Export XML

MalcolmLittle
Regular Contributor

Thanks, Lance. That worked, providing decent output, though there are a lot of junk columns added. Any idea if there's a way to export the field schema as it appears in the Fields table within Pro?

0 Kudos
LanceCole
MVP Regular Contributor

Malcolm Little,

Nothing I am aware of yet.  I know there are a few items under consideration, if you look through the ideas section.  It would be nice if the fields table simply supported copy so it could be pasted into excel as you do for attribute data.

SarahThompson6
New Contributor

I think I've just found a solution to this issue. For example, if you have a File Geodatabase Feature Class, in Catalog View, right-click | Data Design | Fields to see the Fields view. Then, with your mouse, click on the little half-arrow in the top left corner of interface window, to the left of "Field Name". This selects the entire thing. Copy (ctrl c) and then paste into Excel (ctrl v). It works, exactly as we want. Highlighting all the rows does not work, but clicking the upper left arrow to highlight the entire "table" does. (ArcGIS Pro 2.9.3, Excel for Microsoft 365, Windows 10).

Kevin_MacLeod
Frequent Contributor

@SarahThompson6  awesome! Thank you that's perfect. We wanted lists of domains. This provides the list of fields and their domains. This following SQL query I found lists the all the domain values for codes and descriptions. The combination provides the full schema for consideration by project stakeholders.

 

WITH domains AS (SELECT items.uuid AS domain_id, items.Name AS "Domain"   FROM dbo.[GDB_ITEMS] AS items  JOIN dbo.[GDB_ITEMTYPES] AS itemtypes  ON items.Type = itemtypes.UUID    WHERE itemtypes.Name = 'Coded Value Domain'),   fcs AS ( SELECT items.uuid AS fc_id, items.name AS Feature_class, DatasetInfo1 As geom_col   FROM dbo.[GDB_ITEMS] AS items  JOIN dbo.[GDB_ITEMTYPES] AS itemtypes  ON items.Type = itemtypes.UUID    WHERE itemtypes.Name = 'Feature Class') SELECT Feature_Class, domain FROM [dbo].[GDB_ITEMRELATIONSHIPS] JOIN domains ON domain_id = DestID JOIN fcs ON fc_id = OriginID ORDER BY Feature_class

This also apparently lists fields mapped to domain.  These queries can be copied and saved to text and opened in Excel from SQL Server Management Studio.

SELECT
    i.Name AS FeatureClass
    ,xVal.value('Name[1]','nvarchar(max)') Field
    ,xVal.value('DomainName[1]', 'nvarchar(max)') Domain
FROM GDB_ITEMS  i JOIN GDB_ITEMTYPES it
    ON i.Type = it.UUID
CROSS APPLY i.Definition.nodes('/*/GPFieldInfoExs/GPFieldInfoEx') dx(xVal)
WHERE i.NAME IS NOT NULL
    AND xVal.value('DomainName[1]', 'nvarchar(max)') IS NOT NULL
ORDER BY i.NAME

 

0 Kudos