HubDB filter

If I want to execute a code block differently depending on HubDB input, is this the right approach?

I have a hubdb checkbox column called “external”

{% for row in hubdb_table_rows('2620345', "&orderBy=date&visible=true") %}

{% if row.external = null %}

[code 1 here]

{% else %}

[code 2 here]

{% endif %}
{% endfor %}

The line {% if row.external = null %} is not filtering the data correctly.

Do I have that formatted wrong?

If external is checked off, I’d like to make alterations to the code, changing the functionality.

Hi @cives,

If you are trying to set logic based on a checkbox value in HubDB, you can try updating your code to have the following:

{% if row.external == 0 %}

Note that you want to use the double equal sign “==” as the single is typically used to assign a value to a variable. The “external” should return either a 1 or 0 to reflect true/false.


Did my post help answer your query? Help the community by marking it as a solution.

@cives Alternatively, you can also use the following:

{% for row in hubdb_table_rows('2620345', "&orderBy=date&visible=true") %}

{% if !row.external %}

[code 1 here]

{% else %}

[code 2 here]

{% endif %}
{% endfor %}