Skip to content

Instantly share code, notes, and snippets.

@ImkeF
Last active November 19, 2019 17:02
Show Gist options
  • Save ImkeF/749cbaa90a952c68b859db6afa291482 to your computer and use it in GitHub Desktop.
Save ImkeF/749cbaa90a952c68b859db6afa291482 to your computer and use it in GitHub Desktop.
let func =
(SelectionList as list, ListOfPositions as list, optional StartWithOne as number) =>
List.Transform(ListOfPositions, each try if StartWithOne = null then SelectionList{_} else SelectionList{_-1} otherwise null)
, documentation = [
Documentation.Name = " List.SelectPositions
", Documentation.Description = " Selects items from <code>SelectionList</code> by their positions in <code>ListOfPositions</code>
" , Documentation.LongDescription = " Selects items from <code>SelectionList</code> by their positions in <code>ListOfPositions</code>: https://wp.me/p6lgsG-N8 .
", Documentation.Category = " List
", Documentation.Source = " https://wp.me/p6lgsG-N8 .
", Documentation.Author = " Imke Feldmann: www.TheBIccountant.com .
", Documentation.Examples = {[Description = " Details see: https://wp.me/p6lgsG-N8 .
" , Code = " List.SelectPositions({1, 2, 3, 4, 5}, {0, 3, 4})
", Result = " {1, 4, 5}
"]}]
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