APIs & Integrations

nflaherty
Participant

Query HubDB for Video Tags

Here’s my high-level goal:

I’d like to be able to query a HubDB table for videos with certain tags, based on tags that we enter into a custom module.


The setup:

Let’s say I have a table that looks like:

My custom module has a text input. If I input “Sales; Marketing” I should return both rows. If I input “Support” I should only return the first row.

I’m able to turn the inputted string into a list such as [Sales, Marketing] and I can do the same for my table rows (so I get [Marketing, Support] and [Sales]).

I am hoping to then be able to take the intersection of my inputted list and my video tag list, and if the length of that list is > 0, then I show the video.


How I was hoping to do it:

In jinja, I would do this by a conditional statement that looks like this:

{% if (video_tag_list|intersect(inputted_tag_list))|length > 0 %}

Based on HubSpot’s list of supported HubL filters, it does not appear that the classic jinja “intersect” filter is supported.

Does anyone have ideas of other ways to do this?

1 Reply 1
boulter
HubSpot Product Team
HubSpot Product Team

Query HubDB for Video Tags

Hi there,

It looks like you could use a multiselect column type for your tags. Then you could use a contains filter to match rows that contains at least one of the tags.

An intersect filter would help, but it looks like that’s a filter proprietary to SaltStack’s Jinja and not part of the core project. In any case, the query filter is faster.

0 Upvotes