Darshan Hiranandani : Setting Conditional Rules for Many-to-Many Relationships in Knack

Hi everyone,

I’m Darshan Hiranandani, I’ve run into an interesting scenario with Knack and could use some advice.

I have an object, “hairbrush,” which can be associated with multiple companies (e.g., “hairstrait” and “kindahairy”), creating a many-to-many relationship. Now, when I mark a hairbrush as “used” in my table, the idea is that once it’s marked by a company, it should no longer appear in the grid.

Originally, the table looked like this:

Company Object
hairstrait hairbrush
kindahairy hairbrush

The rule I set up before worked fine—when a company marked the hairbrush as “used,” it would disappear from the grid.

However, I recently updated the relationship to allow a hairbrush to be associated with multiple companies. Now, I want to set a rule where the hairbrush should only be marked as “used” when both companies have been flagged.

Here’s my question:
Is there a way in Knack to create a rule that checks if both companies associated with the hairbrush are marked as “used,” and only then mark the hairbrush as “used”? If one company marks it as used, I want the hairbrush to still appear in the grid with the remaining company.

For example, given the following:

Company Object
hairstrait hairbrush
kindahairy hairbrush

If “hairstrait” is marked as “used,” I’d like the grid to show:

Company Object
kindahairy hairbrush

Any suggestions on how I can set this up in Knack or any workarounds you’ve used would be greatly appreciated!

Thanks!
Regards
Darshan Hiranandani

The answer is here in a remarkably similar post.

2 Likes