Skip to content

Instantly share code, notes, and snippets.

@Hugoberry
Last active September 5, 2020 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Hugoberry/a31f70efe6ce9a388b6f705f6e3da8cc to your computer and use it in GitHub Desktop.
Save Hugoberry/a31f70efe6ce9a388b6f705f6e3da8cc to your computer and use it in GitHub Desktop.
[Power Query] Replace an unary function type with a custom type that contains metadata for allowed parameter values
(f as function, allowedValues as list)=>
let
//create a new parameter type with metadata for allowed values
parameterType = Value.Type(allowedValues{1}) meta [Documentation.AllowedValues = allowedValues],
//create a function type with custom parameter type
myFunType = type function (select as parameterType) as function
in //replace the orginal function type with the new myFunType
Value.ReplaceType(f,myFunType)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment