Forum Discussion
Recursive function returns: Evaluation resulted in a stack overflow and cannot continue
- 5 years ago
If I understand your use case, here is one way to do it. I made this this list and called it ListToCheck
= {1,"text", {1..3}, [A="text"]}
Then used this expression that returned a value of 2 (1 list and 1 record).
= List.Count(List.Select(List.Transform(ListToCheck, each Value.Is(_, List.Type) or Value.Is(_, Record.Type)), each _ = true))
If that works, you can convert it to a function with (didn't check this one but I think it will work)
(listname as list) =>
let
x = List.Count(List.Select(List.Transform(listname, each Value.Is(_, List.Type) or Value.Is(_, Record.Type)), each _ = true))
in
x
Pat
If I understand your use case, here is one way to do it. I made this this list and called it ListToCheck
= {1,"text", {1..3}, [A="text"]}
Then used this expression that returned a value of 2 (1 list and 1 record).
= List.Count(List.Select(List.Transform(ListToCheck, each Value.Is(_, List.Type) or Value.Is(_, Record.Type)), each _ = true))
If that works, you can convert it to a function with (didn't check this one but I think it will work)
(listname as list) =>
let
x = List.Count(List.Select(List.Transform(listname, each Value.Is(_, List.Type) or Value.Is(_, Record.Type)), each _ = true))
in
x
Pat