Forum Discussion
Ignored Type Claims for Uri.Type, Guid.Type
Hello,
When using Table.Schema to view details for numeric columns that are Int64.Type or Currency.Type, the type claim that the column is "Int64.Type" or "Currency.Type" shows up in Table.Schema's column TypeName (good!).
However, for columns of Guid.Type and Uri.Type, Table.Schema's TypeName column simply shows Text.Type. How would I go about seeing that these columns claim to be Guid.Type and Uri.Type, respectively? I'd expect this info to be displayed in Schema's TypeName column, like it is for the numeric columns, but it isn't.
Example:
let
Data = #table(type table [IntColumn=Int64.Type, CurrencyColumn=Currency.Type, GuidColumn=Guid.Type, UriColumn=Uri.Type], {})
in
Table.Schema(Data)
Outputs:
Notice how the columns with the numeric "subtype" claims (Int64.Type and Currency.Type) display this claim in column TypeName while the two columns with text "subtype" claims (Guid.Type and Uri.Type) don't have this claim displayed in column TypeName.
Thank you!
You can use Type.TableColumn(Value.Type(table), "ColumnName") to get the type of a column and test if it is equal to Guid.Type, Uri.Type, or Password.Type
4 Replies
- artemus
Microsoft Employee
You can use Type.TableColumn(Value.Type(table), "ColumnName") to get the type of a column and test if it is equal to Guid.Type, Uri.Type, or Password.Type
- Ben-Dev
Helper II
- artemus
Microsoft Employee
Unfortunatly, any changes here risk breaking backwards compadibility. Here is a function that adds the Type column to the schema:
(tbl) => Table.Join(Table.Schema(tbl), "Name", Table.ExpandRecordColumn(Value.ReplaceType(Record.ToTable(Type.RecordFields(Type.TableRow(Value.Type(tbl)))), type table [Name=text,Value=[Optional=logical, Type=type]]), "Value", {"Type"}), "Name", JoinKind.Inner)