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
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 738 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive