Hello,
I need to use a formula to filter out several items and then for those that are false to come out in an output
thanks
Solved! Go to Solution.
Some sample data might be helpful here to get you to the right option. Two thoughts:
You can create a new Boolean variable in the formula and then assign it "False" based upon the conditions being met. Then you use a filter as described by @Luke_C and connect and output data tool to your False anchor...
I am not sure how to provide sample data since it is confidential.
I need to have filter/formula for MDO Name= GBG, Program= 01 or 02, Plan Code= 1G or 2D, MEthod received= V or W, Received by= 1
and so forth then these columns that do not have these specific things listed to come as false statement? And can this come out as an output as well, is this possible?
ANY HELP IS GREATLY APPRECIATED.
🙂
So, use the Boolean Variable for all the columns I listed and assign it to False? So this would all be in one column formula?
Sorry I am new to this field 😕
It's up to you if you want to assign it true or false as long as you standardize it and make the value uniform - but if you use a ton of and statements in your formula tool you can check that all the variables all match/don't match and then set a uniform boolean variable for the columns you want outputed.
You can then filter for the variable which you want and then output from the anchor.
Let's say that I want to extract records where a, b and c don't have certain values:
I'd use if A!=x and B!=Y and C!=Z then "True" else "false" endif
then in my filter i'd just put the new field name and it will test for it.
In this case I'd want the True anchor.
Thank you--- so I added all the columns with what they should = but for the filter which column name do I use or do I have to separate each column to have its own true/false statement?
I don't know what to put for my filter to filter out all the columns with FALSE
thanks
It really depends on the logic, is there one ultimate column that you need to filter the dataset on or multiple? The filter tool offers a 'Basic' and 'Custom' filter options. For basic, filtering out false is super easy and would just depend on if the datatype of the field is a string or bool. If it's bool, you would see the following (note, in both examples you'd need to use your own fields instead of 'field1')
If it is string, you can do something like this:
For a custom filter (i.e. you want to filter out where column A AND/OR column B is false) you could try something like the below - again depending on the data types:
As always, any sample data or screenshots you provide will help get you the best approach.
Also would recommend this interactive lesson on filtering. It's only 7 minutes and well worth the time.
https://community.alteryx.com/t5/Interactive-Lessons/Filtering-Data/ta-p/76301
If you have a final column where the entries you want are all labeled "false" you can filter that column - and if its boolean just put it in the customer filter...
ie [boolean field]
Your false records will now be in the false anchor.
NOTE - say for design sake you want to take all the records from the true anchor - even though their boolean value is false... you can use:
not([boolean field]) or ![boolean field] - both of which would produce not(false) - or True.