locked
Remove Errors in list RRS feed

  • Question

  • I made a formula that returns a list, each list item is text type.
    My problem is, i want to know if there are items that is a number, then I do this:

    List.Transform([My List], try Number.From otherwise null)

    The 'try <> otherwise <>' is not working, it not returns null, it returns a error, but that's ok, if returns an error is because is not a number. Then my problem starts... I tried everything to remove errors inside the list or chance them to "null" but nothing works.
    Any idea??

    Friday, January 9, 2015 3:01 PM

Answers

  • You need to write that in the form of a function:

    List.Transform(list, (value) => try Number.From(value) otherwise null)

    or using the "each" shorthand,

    List.Transform(list, each try Number.From(_) otherwise null)

    Friday, January 9, 2015 4:44 PM

All replies

  • You need to write that in the form of a function:

    List.Transform(list, (value) => try Number.From(value) otherwise null)

    or using the "each" shorthand,

    List.Transform(list, each try Number.From(_) otherwise null)

    Friday, January 9, 2015 4:44 PM
  • Thanks!
    Friday, January 9, 2015 7:08 PM