let
Source =
let
func = // fnPowerTrim
let
input = (text as text, optional char_to_trim as text) =>
let
char = if char_to_trim = null then " " else char_to_trim,
split = Text.Split(text, char),
removeblanks = List.Select(split, each _ <> ""),
result = Text.Combine(removeblanks, char),
fnType = type function (
optional char_to_trim as (
type text meta [Documentation.AllowedValues = {"-", ";", ":"}]
)
) as list
meta [
Documentation.Name = "fnPowerTrim",
Documentation.LongDescription = "Choose character to trim"
]
in
Value.ReplaceType(result, fnType)
in
input,
documentation = [
Documentation.Name = " Function.PowerTrim ",
Documentation.Description = " Trims Excess Spaces. ",
Documentation.LongDescription
= " Add Column, Invoke Custom Function, Choose Column to Trim. ",
Documentation.Category = " Trim Function ",
Documentation.Source = " TVCA PowerBI Team ",
Documentation.Version = " 02 / 09 / 2022 ",
Documentation.Author = " Imran Haq ",
Documentation.Examples = {
[
Description = " Neat function to remove excess spaces ",
Code = " Trims All Spaces ",
Result = " Trims All Spaces "
]
}
]
in
Value.ReplaceType(func, Value.ReplaceMetadata(Value.Type(func), documentation))
in
Source
Last active
April 25, 2022 09:54
-
-
Save PBI-DataVizzle/55483cf0c99fa02b33f112e4e8b61db9 to your computer and use it in GitHub Desktop.
Trying to figure out AllowedValues parameter metadata
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment