File Geodatabase views should support domains

815
6
07-27-2023 01:27 PM
Status: Open
Labels (1)
AJR
by
Occasional Contributor II

File geodatabases now support views (which is great), but the views can't have domains applied to them (this should be fixed).  If I have a view that pulls out a subset of data from a table and that table has domains applied to it, I should be able to apply those same domains to the file geodatabase view of the data subset, but this can't be done.  It makes (some) sense that views aren't editable, but since they are registered with the geodatabase I can't think of any reason why allowing domains to be applied to them shouldn't be possible.

6 Comments
SSWoodward
Status changed to: Needs Clarification

Thanks for the Idea, @AJR 

Could you help me understand your desired workflow a bit more? Are you asking for the ability to edit fgdb database views? OR are you asking to see domain descriptions in the view as opposed to the domain codes?


Bud
by

A different take on this idea might be:
Need to access FGDB system tables using SQL. For example, provide a way to query for domain values (codes and descriptions) for a given domain.


We can do it in enterprise geodatabases like Oracle EGDBs.

What I do is create individual views to get the domain values (codes and descriptions) for a given domain.

 

The old way (EXTRACTVALUE has been deprecated in Oracle):

create or replace view d_atn_type as 
elect substr(extractvalue(codedvalues.column_value,'CodedValue/Code'),1,255) as code, substr(extractvalue(codedvalues.column_value,'CodedValue/Name'),1,255) as description from sde.gdb_items_vw i join sde.gdb_itemtypes it on i.type = it.uuid, table(xmlsequence(xmltype(definition).extract('/GPCodedValueDomain2/CodedValues/CodedValue'))) codedvalues where i.name = 'ATN_TYPE'

The new way (using XMLTABLE):

create or replace view d_atn_type as
select cast(rownum as number(38,0)) as rownum_, x.code, x.description, i.name as domain_name from sde.gdb_items_vw i cross apply xmltable( '/GPCodedValueDomain2/CodedValues/CodedValue' passing xmltype(i.definition) columns code varchar2(255) path './Code', description varchar2(255) path './Name' ) x where i.name = 'ATN_TYPE'

Bud_1-1690980953288.png

 

Then in a query/view where I'm selecting data from an EGDB table or FC, I join from the field that has the domain code to the domain view to get the domain description:

select
    objectid,
    atn_id,
    type as type_code,
    d.description as type_description
from
    infrastr.active_transportation a
left join
    infrastr.d_atn_type_vw d
    on a.type = d.code

Bud_0-1690998400795.png

 

But that's not possible with file geodatabases, since we can't access the system tables via SQL.

 

AJR
by

@SSWoodward - I'm not asking to be able to edit a file geodatabase view (although that would be nice), I'm looking to be able to apply domains to a file geodatabase view.  So in answer to your question, I'm looking to see the domain descriptions displayed when viewing the fgdb view data (rather than the real data values).

SSWoodward
Status changed to: Open

Thanks for clarifying @AJR 

I've moved this back to open to gain support. 

AJR
by

And really, this isn't file geodatabase specific issue.  Domains should be able to be applied to enterprise geodatabase registered views.