Last active
May 17, 2018 05:45
-
-
Save ImkeF/0b26e771dbcfba362a97d7bf09d4cb33 to your computer and use it in GitHub Desktop.
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
let func = | |
(optional SelectedType as type) => | |
let | |
/* Debug Parameters | |
SelectedType = type table, | |
End of debug parameters */ | |
Source = #shared, | |
ToTable = Record.ToTable(Source), | |
// "GoogleAnalytics.Accounts is currently the first inbuilt function that appears. | |
// This might change in the future and would have to be adjusted then. | |
FindFirstNativeFunction = List.PositionOf(ToTable[Name], "GoogleAnalytics.Accounts"), | |
#"Kept First Rows" = Table.FirstN(ToTable, FindFirstNativeFunction-1), | |
#"Removed Errors" = Table.RemoveRowsWithErrors(#"Kept First Rows", {"Value"}), | |
#"Filtered Rows" = Table.SelectRows(#"Removed Errors", each Value.Is([Value], SelectedType))[Name], | |
Custom2 = if SelectedType = null then Text.Combine(#"Removed Errors"[Name], """, """) else Text.Combine(#"Filtered Rows", """, """), | |
Custom3 = """" & Custom2 & """" | |
in | |
Custom3 , | |
documentation = [ | |
Documentation.Name = " Text.QueryNames ", | |
Documentation.Description = " Creates a string with all query names from the current file. Can only be used in the query editor, as shared will not work when loaded to the data model ", | |
Documentation.LongDescription = " Creates a string with all query names from the current file. Can only be used in the query editor, as shared will not work when loaded to the data model. Optional <code>SelectedType</code> can be used to filter a specific return type. ", | |
Documentation.Category = " Text ", | |
Documentation.Source = " local ", | |
Documentation.Version = " 1.1: Added option to select a specific return type ", | |
Documentation.Author = " Imke Feldmann: www.TheBIccountant.com . ", | |
Documentation.Examples = {[Description = " ", | |
Code = " ", | |
Result = " "]}] | |
in | |
Value.ReplaceType(func, Value.ReplaceMetadata(Value.Type(func), documentation)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment