Array Function in Beast Mode

Hello,
I created a card where users can filter multiple IDs at once. This is useful to quickly filter the card based on the account IDs that we got from another card. Users can simply highlight all the Account IDs, copy and paste them in the Input Text Box
The variable is called enter_account_ids. Is there a better approach than this formula?
I realized that IN() function only works if the items within it are individual strings so I just can't reference the variable enter_account_ids even if I fixed the format to be csv. With that I can't find anything else apart from SPLIT_PART. However, part of its syntax is the position of the string you wanted to extract so I had to make 700 lines of them to make sure all the account ids that will be entered in the variable will be included in filtering the card. I wonder if there's any function available in Beast Mode like the TEXTSPLIT() in excel or anything that would simply split all the strings through the specified delimiter without the need to specify any position. Any alternative will do as long as not this long.
Thank you.
Best Answers
-
@MichelleH approach seems like the more reliable option, clearly you'll need to tweak it a bit, since if for example your user provides 1013 as the Id to look for, this would match accounts Ids 10, 101 and 13 as well, if you know that the list of IDs will always be separated by spaces, then you could do something like:
CASE WHEN INSTR(`enter_account_ids`,CONCAT(' ',`account_id`,' ')) > 0 //Id is in the middle || `enter_accounts_ids` LIKE CONCAT('% ',`account_id`) //ends with the Id
|| `enter_accounts_ids` LIKE CONCAT(`account_id`,' %') //starts with the Id
|| `enter_accounts_ids` = `account_id` // Is the only Id THEN 'true'
ELSE 'false'
END1
Answers
-
@MichelleH approach seems like the more reliable option, clearly you'll need to tweak it a bit, since if for example your user provides 1013 as the Id to look for, this would match accounts Ids 10, 101 and 13 as well, if you know that the list of IDs will always be separated by spaces, then you could do something like:
CASE WHEN INSTR(`enter_account_ids`,CONCAT(' ',`account_id`,' ')) > 0 //Id is in the middle || `enter_accounts_ids` LIKE CONCAT('% ',`account_id`) //ends with the Id
|| `enter_accounts_ids` LIKE CONCAT(`account_id`,' %') //starts with the Id
|| `enter_accounts_ids` = `account_id` // Is the only Id THEN 'true'
ELSE 'false'
END1 -
Wow! I can't believe it's that simple. Thank you @MichelleH and @marcel_luthi, it works just the same. Plus, if ever we reach more than 700 accounts in the future, there's no need to add more lines in the formula. Thanks!
0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 656 Datasets
- 115 SQL DataFlows
- 2.2K Magic ETL
- 811 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 80 App Studio
- 45 Variables
- 771 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 77 Workflows
- 23 Code Engine
- 36 AI and Machine Learning
- 19 AI Chat
- AI Playground
- AI Projects and Models
- 17 Jupyter Workspaces
- 410 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 10 Software Integrations
- 142 Manage
- 138 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive