Is there a 'switch' tool similar to the 'filter' tool
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Right now, I am using nested filters to make multiple decisions on data. I've also used nested if then else filter statements.
These are wonky workarounds that are difficult to create and difficult to troubleshoot.
What I'd like is a real switch tool I could drop in and have a single input and an arbitrary number of outputs.
switch (age) { case 1: printf("You're one."); break; case 2: printf("You're two."); break; case 3: printf("You're three."); break; case 4: printf("You're four."); break; default: printf("You're neither!") }
This is what I am talking about.
My use case is that I have data in a spreadsheet and I need to break some of the columns into multiple columns. Unfortunately, the formula for how the column should be parsed varies based on the value in another column.
Specifically, it is vulnerability data and the different products need to be parsed differently to get something that looks uniform after the transformation.
Hey, look. I've attached a sample workflow and spreadsheet!
Solved! Go to Solution.
- Labels:
- Optimization
- Parse
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
There is a switch function available in the formula tools (it's in the conditional functions). This would work for you if you could build the formula you needed within the formula tool. I see that you use Regex in some cases and there are Regex functions within the String functions but they don't have the same range of functionality as the Regex Tool. If you can use the string functions to get what you want the Switch would work, if not then the way you're doing things looks like it does the job.
Thanks for sharing the workflow and date - that helps alot!
Cheers,
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I'll see what I can do with this.
I was hoping for something that would let the case for each matching item be a connection to another tool instead of just a substitution. There may be a way to do that, but I am not advanced enough to know it.
Thank you for the detailed reply.
-Jasey
