CMS Development

faizwaris
Membre

Using contact property as filter query in the hubdb_table_rows() function

Hi,

I have a table (id = 5461277), two columns in the table are - 'trip_code' and 'trip_name'

I have a contact property named 'drdestination1' which is equal to 'trip_code' value in the table above.

I want to dynamically display 'trip_name' column value for every user with unique 'drdestination1' contact property. I'm not getting any value for 'trip_name' as the filter query passed is not correct. What's the right way to achieve this?

This is the code I'm using - 

{% set abc = contact.drdestination1%}
Contact Property is: {{abc}}
{% for row in hubdb_table_rows(5461277, "trip_code=contact.drdestination1") %}
{{row.trip_name}}
{% endfor %}

0 Votes
3 Réponses
MBERARD
Contributeur de premier rang | Partenaire solutions Elite
Contributeur de premier rang | Partenaire solutions Elite

Using contact property as filter query in the hubdb_table_rows() function

Hi @faizwaris ,

I think that the contact property value is not rendered when you quering your hubdb.

Can you try the following code:

{% for row in hubdb_table_rows(5461277, "trip_code={{ contact.drdestination1|render }}") %}
    {{row.trip_name}}
{% endfor %}

 

Kind regards,

Matthieu

matthieu.berard@markentive.com

KarrarJafri
Membre

Using contact property as filter query in the hubdb_table_rows() function

Hi,
I'm trying to filter hubDB rows based on the HubDB row id (hs_id) with in operator on contact property (recommended_courses) which is coma separate text field of ids. To get multiple rows. The constant values in the IN operator work but when contact.recommended_courses it doesn't fetch any data from the hubDB table.

Here's my module code. The module is used in the marketing email.

<table style="height: auto;
font-family: Helvetica,Arial,sans-serif;
font-weight: 800;
justify-items: center;">
<tr style="display: flex; gap: 12px;">

{% set recommended_courses = "158525437772,158525437487,158183984040" %}
{% for courseCatalog in hubdb_table_rows("course_catalog", "hs_id__in="+(contact.recommended_courses || "158183984040,158525437772") |render) %}
<td style="display: grid; width: 33%; grid-template-rows: 110px 116px max-content; align-items: end; justify-items: center;" >
<h3 style="font-family: Helvetica,Arial,sans-serif;
font-weight: 800;
align-self: start;
justify-self: start;
height: 100px;" >{{ courseCatalog.course_title }}</h3>

</td>
{% endfor %}
</tr>
</table>

0 Votes
faizwaris
Membre

Using contact property as filter query in the hubdb_table_rows() function

it's showing syntax error for this

0 Votes