-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathfxColumnNamesTransition.pq
53 lines (53 loc) · 1.86 KB
/
fxColumnNamesTransition.pq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
let
fx =
(#"Identifier" as table) =>
let
#"Column Cleaner" =
Table.TransformColumnNames(
#"Identifier",
each
Text.Proper(
Replacer.ReplaceText(
Text.Combine(
Splitter.SplitTextByCharacterTransition(
{"a".."z"},
{"A".."Z"}
)(_),
" "
),
"_",
" "
)
)
)
in
#"Column Cleaner",
Documentation_Meta = [
Documentation.Name = "Column Renamer",
Documentation.Description = "Creates readable column names by transforming column headers and outputting in proper casing.",
Documentation.Examples = {
[
Description = "Splits characters that transition from a lower case to an upper case value.",
Code = "HelloWorld",
Result = "Hello World"
],
[
Description = "Replaces underscores with spaces",
Code = "Customer_Address",
Result = "Customer Address"
],
[
Description = "Replaces underscores with a space and transforms to proper cased text.",
Code = "FIRST_NAME",
Result = "First Name"
]
}
]
in
Value.ReplaceType(
fx,
Value.ReplaceMetadata(
Value.Type(fx),
Documentation_Meta
)
)