Forum Discussion
Receiving errors when trying to pass and evaluate fields between functions
Hi Gabe_V ,
your function expects a list of records as the first parameter, but you are feeding it a simple record instead (_ represents all fields of the current row in a record format).
Modifying the call like so should work technically, but I cannot say if that is what you were really after with your function at the end:
#"Added Custom" = Table.AddColumn(#"Flag 2b", "Flag 2 Test", each #"Output Check"({_},[DescriptionTypeValue]))
Wrapping the _ into curly brackets: {_} will put the current record into a list.
Hi ImkeF Thank you for your feedback. I tried what you suggested, and although I think it fixed that problem, now I get "Expression.Error: We cannot convert a value of type Table to type Logical." In my function, I am using two nested Table functions, but I don't see how else I can reach my objective of inputting a field (r row and c column), evaluating if it contains the text "(SMT)", and then returning true or false to the custom column, "Flag 2 Test" based on if it finds that text or not. Am I overthinking/over-engineering it?
- AlienSx2 years agoSuper User
Hi, Gabe_V do you really need a custom function? Why not simply
#"Added Custom" = Table.AddColumn(#"Flag 2b", "Flag 2 Test", each Text.Contains([DescriptionTypeValue], "(SMT)"))?
- Gabe_V2 years agoHelper I
Hi AlienSx,
That's a good question, and one that I knew would probably be asked eventually. Its mostly because this is a bare-bones version of the ultimate function, which will eventuall need to a) perform much more complex "if then" logic, and b) be able to take values from different tables' fields and compare them against each other, etc.