Forum Discussion
MStaford
1 year agoRegular Visitor
Case insensitive table.findtext across multiple columns
Hi All, I have a situation where I have to bring across only those rows where a specific values specific value (lets say, "true") appears in 5 selected columns with multiple files with each includi...
- 1 year ago
Hi MStaford
Still using the same code in my initital post but changing List.AllTrue to List.AnyTrue to check if at least one of the column values contains the word true..
let // Step 1: Define a list of values, replace with the actual column names ColumnsAsAList = {[bla1], [yaba2], [daba3], [lama], [doo]}, // Step 2: Convert each value in the list to a logical (true/false) ChangedType = List.Transform(ColumnsAsAList, Logical.From), // Step 3: Check if all values in the list are true. Use List.AnyTrue to return true if any of the values in the list is true TrueOnly = List.AnyTrue(ChangedType) in TrueOnly
MStaford
1 year agoRegular Visitor
Thankyou for your reply and suggested solutions. The minimum condition for true value to be the result is that atlease one col should have a true value and only if all appears false then the result should be false. Apologies if i was not clear in my notes above. Here is a quick sample..
| Col1 | Col2 | col3 | col4 | col5 | Result |
| true | true | true | true | true | true |
| true | false | true | false | true | true |
| true | false | false | false | false | true |
| false | false | false | false | false | false |
AnonymousI have not tried your method but will give it a go and come back.
danextian
1 year agoSuper User
Hi MStaford
Still using the same code in my initital post but changing List.AllTrue to List.AnyTrue to check if at least one of the column values contains the word true..
let
// Step 1: Define a list of values, replace with the actual column names
ColumnsAsAList = {[bla1], [yaba2], [daba3], [lama], [doo]},
// Step 2: Convert each value in the list to a logical (true/false)
ChangedType = List.Transform(ColumnsAsAList, Logical.From),
// Step 3: Check if all values in the list are true. Use List.AnyTrue to return true if any of the values in the list is true
TrueOnly = List.AnyTrue(ChangedType)
in
TrueOnly