Skip to content
All gists
Back to GitHub
Sign in
Sign up
Sign in
Sign up
{{ message }}
Instantly share code, notes, and snippets.
Hugoberry
/
NavigateShared.cs
Last active
April 27, 2017 11:05
Star
0
Fork
0
Star
Code
Revisions
8
Embed
What would you like to do?
Embed
Embed this gist in your website.
Share
Copy sharable link for this gist.
Clone via HTTPS
Clone with Git or checkout with SVN using the repository’s web address.
Learn more about clone URLs
Download ZIP
Power Query navigate the documentation of #shared functions. [M code]
Raw
NavigateShared.cs
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
Show hidden characters
let
sharedTab
=
Record
.
ToTable
(#
shared
),
//
select only functions from #shared
functions
=
Table
.
SelectRows
(
sharedTab
,
each
Type
.
Is
(
Value
.
Type
([
Value
]),
type
function
)),
//
parse Module from function name
modules
=
Table
.
AddColumn
(
functions
,
"
Module
"
,
each
Text
.
Split
([
Name
],
"
.
"
){
0
},
type
text
),
functionNames
=
Table
.
AddColumn
(
modules
,
"
FunctionName
"
,
each
List
.
Last
(
Text
.
Split
([
Name
],
"
.
"
)),
type
text
),
//
get category from documentation
categories
=
Table
.
AddColumn
(
functionNames
,
"
Category
"
,
each
try
Value
.
Metadata
(
Value
.
Type
(
Record
.
Field
(#
shared
,[
Name
])))[
Documentation
.
Category
]
otherwise
"
"
),
//
parse only the first code example from documentation
examples
=
Table
.
AddColumn
(
categories
,
"
Examples
"
,
each
let
eg
=
Value
.
Metadata
(
Value
.
Type
(
Record
.
Field
(#
shared
,[
Name
])))[
Documentation
.
Examples
]?
in
if
Type
.
Is
(
Value
.
Type
(
eg
),
type
record
)
then
eg
[
Code
]
else
eg
{
0
}
?
[
Code
]
?
),
//
get the short description from the documentation
descriptions
=
Table
.
AddColumn
(
examples
,
"
Description
"
,
each
Value
.
Metadata
(
Value
.
Type
(
Record
.
Field
(#
shared
,[
Name
])))[
Documentation
.
Description
]
?
),
//
parse subcategories
subcategories
=
Table
.
AddColumn
(
descriptions
,
"
DotCategory
"
,
each
List
.
Last
(
Text
.
Split
([
Category
],
"
.
"
))),
//
adding the signature of the functions
out
=
Table
.
AddColumn
(
subcategories
,
"
Signature
"
,
each
Signature
(
Record
.
Field
(#
shared
,[
Name
])))
in
out
Sign up for free
to join this conversation on GitHub
. Already have an account?
Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.