Hi ciyepiz, once again, it’s been super busy, so sorry I haven’t been able to get to this. I’ve got some good news and bad news:
GOOD NEWS: I can walk you through creating tags and filtering on demand, so only coupons with the selected tag gets displayed!
BAD NEWS: I discovered I have a bug, so it only works if each coupon has ONE tag (for now - I’m working on a solution)
MAYBE that’s enough for what you need to accomplish (and I don’t want you to have to wait for me), so I’ll show you what I’ve worked up thus far…
So, what I’ve worked up will behave like this (only imaging there is 1 tag per coupon, instead of multiple):
I accomplished this by having a data type category, which is a simple list of text names for categories, and a data type offer which includes a List of Categories as one of the fields.
That data type setup lets me create a list of categories (i.e. tags, in this case), and associate any number of them with an offer data type. On the user-facing page, I’ve got 2 repeating groups - one is powered by a list of category names with a checkbox, and the other by a list of offers. On the category names repeating group, I’ve created a custom state that I’ve called Selected offers. It’s type is offer, and it is a list. The offers repeating group has the data source set to the category names repeating group custom state. In other words, I’m building a list of offers as a custom state on the categories, and displaying that list to the user in the other repeating group. Make sense so far?
From there I created a new workflow on “Elements” > “An inputs value is changed”:
I chose the checkboxes in the categories repeating group as the element to watch for change. From there I added an action, and selected “Element Actions” > “Set State”. I chose the “Selected offers” state on the category name repeating group and set the value to RepeatingGroup Category’s Selected Offers MERGED WITH Search for Offers. The …Search for Offers dialog is set to search for offers with the current cell category in the Categories list.
I’ve also set the “Only when” validation field to “This Checkbox is checked”.
To remove offers from the displayed list, I created another action, and selected “Element Actions” > “Set State”. I chose the “Selected offers” state on the category name repeating group and set the value to RepeatingGroup Category’s Selected Offers INTERSECTS WITH Search for Offers. The INTERSECTS condition takes two lists, compares them, and returns only the items that are present in BOTH. I’m removing the now undesired offers using …Search for Offers and searching everything that DOES NOT contain the category in the cell we just unchecked. Finally, I set the “Only when…” validation to “This Checkbox Isn’t Checked”.
I hope that all makes sense. It’s an interesting problem to solve, and I’m working on making it function as expected for multiple tags. Hopefully this will get you where you need to be, but I’ll post an update here regardless, once I’ve got this worked out.
-Jon