It’s been a while 那 I am working with 数据 data source in 辽宁体育彩票 双. One challenge 那 I almost always do not have a good understanding of the underlying data model. It can be really hard and time consuming if there is no one in the business 那 understands the underlying data model. I know, we can use $metadata to get the metadata schema from the 数据 feed, but let’不去那里。我不是OData专家,但是这里是像我这样的人的事,我使用的数据源不一定是专家,但我需要了解实体是什么,它们如何连接等…那如果我没有任何中小型企业(S对象 M东北黑钙土 Expert)谁可以帮助我?
因此,参与更多OData选项,让’s get into it.
The custom function below accepts an 数据 URL then it discovers all tables, their column count, their row count (more on this later), number and list of related tables, number and list of columns of type text, type number and Decimal.Type.
// fnODataFeedAnalyser
(ODataFeed as text) =>
let
Source = OData.Feed(ODataFeed),
SourceToTable = Table.RenameColumns(
Table.DemoteHeaders(Table.FromValue(Source)),
{{"柱1", "Name"}, {"柱2", "数据"}}
),
FilterTables = Table.SelectRows(
SourceToTable,
each Type.Is(Value.Type([Data]), Table.Type) = true
),
SchemaAdded = Table.AddColumn(FilterTables, "Schema", each Table.Schema([Data])),
TableColumnCountAdded = Table.AddColumn(
SchemaAdded,
"Table 柱 Count",
each Table.ColumnCount([Data]),
Int64.Type
),
TableCountRowsAdded = Table.AddColumn(
TableColumnCountAdded,
"Table Row Count",
each Table.RowCount([Data]),
Int64.Type
),
NumberOfRelatedTablesAdded = Table.AddColumn(
TableCountRowsAdded,
"Number of Related Tables",
each List.Count(Table.ColumnsOfType([Data], {Table.Type}))
),
ListOfRelatedTables = Table.AddColumn(
NumberOfRelatedTablesAdded,
"List of Related Tables",
each
if [Number of Related Tables] = 0 then
null
else
Table.ColumnsOfType([Data], {Table.Type}),
List.Type
),
NumberOfTextColumnsAdded = Table.AddColumn(
ListOfRelatedTables,
"Number of Text 柱s",
each List.Count(Table.SelectRows([Schema], each Text.Contains([Kind], "text"))[Name]),
Int64.Type
),
ListOfTextColunmsAdded = Table.AddColumn(
NumberOfTextColumnsAdded,
"List of Text 柱s",
each
if [Number of Text 柱s] = 0 then
null
else
Table.SelectRows([Schema], each Text.Contains([Kind], "text"))[Name]
),
NumberOfNumericColumnsAdded = Table.AddColumn(
ListOfTextColunmsAdded,
"Number of Numeric 柱s",
each List.Count(Table.SelectRows([Schema], each Text.Contains([Kind], "number"))[Name]),
Int64.Type
),
ListOfNumericColunmsAdded = Table.AddColumn(
NumberOfNumericColumnsAdded,
"List of Numeric 柱s",
each
if [Number of Numeric 柱s] = 0 then
null
else
Table.SelectRows([Schema], each Text.Contains([Kind], "number"))[Name]
),
NumberOfDecimalColumnsAdded = Table.AddColumn(
ListOfNumericColunmsAdded,
"Number of Decimal 柱s",
each List.Count(
Table.SelectRows([Schema], each Text.Contains([TypeName], "Decimal.Type"))[Name]
),
Int64.Type
),
ListOfDcimalColunmsAdded = Table.AddColumn(
NumberOfDecimalColumnsAdded,
"List of Decimal 柱s",
each
if [Number of Decimal 柱s] = 0 then
null
else
Table.SelectRows([Schema], each Text.Contains([TypeName], "Decimal.Type"))[Name]
),
#"Removed Other 柱s" = Table.SelectColumns(
ListOfDcimalColunmsAdded,
{
"Name",
"Table 柱 Count",
"Table Row Count",
"Number of Related Tables",
"List of Related Tables",
"Number of Text 柱s",
"List of Text 柱s",
"Number of Numeric 柱s",
"List of Numeric 柱s",
"Number of Decimal 柱s",
"List of Decimal 柱s"
}
)
in
#"Removed Other 柱s"