Alternative to Contains function
- 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
Solved! Go to Solution.
- Labels:
- Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@peterlyngvig for this scenario, I'd probably use the Find & Replace tool. Although the lookup table may take a little while to set up, it'll be significantly quicker than typing out a massive if statement as per your current approach, and easy to add to in future.
You basically set up your lookup table like so, where [String Check] here is the target that will be looked for within [item], and [Company Name] is the company name you want to be appended if that match is found.
Your Find & Replace tool configuration should then look like this. Find within field is your target field (item) that the tool will be looking within. As the target substring can be anywhere as you mentioned in your post, we need to select 'any part of field' and if the name can vary in terms of capitalisation, opt for 'case insensitive find'. Under the 'find value' dropdown, this is where we first reference our reference table - here the Find & Replace tool essentially becomes a Contains() function where it's basically saying, Contains([item], [String Check]). Upon a successful match, we then want to display the relevant [Store Name] next to that record, which is why we set the final part of the configuration to do just that:
Your outcome will then look like this:
The reason there's a lot of nulls is because I only pulled a few targets/company names from your if statement to build a quick lookup table example so matches haven't been found for all records.
If you'd like any further explanation or have any extra questions then fire away!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @DataNath, this was really helpful :)
