I’m after some advice on the best way to compare some data.
I have an offer that is available to certain groups of people. It is stored as Metadata so will have values such as:
Group1; Group3; Group 4
I have users that belong to a number of groups, again using metadata, for instance:
Group1; Group2; Group 3
If any of the user groups matches any of the offer groups then the asset should be displayed.
I can’t find an elegant solution. It’s simple if a user is just in one group but the many to many test is befuddling me. Any ideas would be greatly appreciated.
Is there a way to iterate around an array and then use a regex asset or just ^contains to see if that lives inside the other list?
Where are you showing/hiding the assets? In an asset listing?
If you were just listing the assets, you could use a stored search page and have the search term be dynamic based on the user’s metadata, as in, use that as a search term to pass to the stored search page and then display them as search results.
Apologies, got waylaid from this. I was planning to use an asset listing but like the idea of a dynamic search page and it nearly works superbly.
I do have one killer issue though. On a standard search page you have the option to select ‘Any of the words’ or ‘all of the words’. If I use a stored search, with 4 parameters of %globals_user_metadata_FirstEmployer% to %globals_user_metadata_ForthEmployer%, only the first parameter is ever used in the query.
Is it possible to use the ‘Any of the words’ syntax in a stored search?
Hmm, I have a vauge recolection that I have made this work before with multiple parameters. What happens if you hard code the values instead of using keywords, does it work then?