Last active
February 23, 2017 17:55
-
-
Save Hugoberry/f413d1dd8a13ec9cf15937029035f0bf to your computer and use it in GitHub Desktop.
Get a list of expandable columns from a table input in Power Query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expandableColumns = (_) => List.Accumulate( | |
Table.ColumnNames(_), | |
{}, | |
(s,c)=>s&(if Type.Is(Value.Type(Record.Field(_{0},c)), type record) | |
or Type.Is(Value.Type(Record.Field(_{0},c)), type list) | |
then {c} | |
else {} | |
) | |
), | |
columnHasConsistentType = (T,Cname) => | |
let | |
columnTypes = List.Accumulate(Table.Column(T,Cname), | |
{}, | |
(s,c)=>s&{Type.RecordFields(Value.Type(c))}) | |
in List.Accumulate(columnTypes, | |
true, | |
(s,c)=>s and (columnTypes{0}=c)), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment