How to add data in tabular format in hubdb column

Highlighted
Occasional Contributor

I have used hubdb to store faq question and answer .One of my question have answer in tabular format.Please check attached file for same.Can you let me know how to add it in hubdb table answer column or is there any alternative solution to save these values in hubdb and display countries in attached formatimage001.png

Reply
0 Upvotes
3 Replies 3
HubSpot Moderator

Hi @nutan1,

 

I think you might be able to accomplish this by using a multi-select column. I'm not entirely sure I understand how the table is being used on a page though. Do you have a URL you could send over for me to look at? It might help me better understand what your HubL would look like.

 

If every answer (except this one) is just stored in a text or rich text column, then for this one question you could leave that column blank. And add a new column that's a multi-select column. And then you could use HubL to look for this question and instead display the multi-select field instead of the text or rich text field for this row.

 

I'm happy to help you understand the structure of that if you decide to go this route, so let me know. And again, if you have a URL for me to look at, that will help too.

 

 - Leland

Leland Scanlan

HubSpot Developer Support
Reply
0 Upvotes
Occasional Contributor

I am currently working with multiselect column.Can you let me know how to print data from multiselect column using hubl.

Reply
0 Upvotes
HubSpot Moderator

Hi @nutan1,

 

I actually just answered a similar question about multiselect fields and HubL the other day. Could you take a look at my response here: https://community.hubspot.com/t5/CMS-Development/How-to-Get-Filtered-Data-From-HubDB-from-Multiple-S... and let me know if that helps? I've included some examples for how to see what the structure of that data looks like, and also for how to loop through it.

 

I guess from what I understand you're trying to do, I was thinking that something along these lines would do the trick:

 

{% for row in table %}
  {% if row.name = "your-multiselect-row-name" %}
    {# logic for multiselect column #}
  {% else %}
    {# logic for other queston and answer fields #}
  {% endif %}
{% endfor %} 

But let me know if you have any trouble with it or if this isn't working for what you're trying to do.

 

 - Leland

Leland Scanlan

HubSpot Developer Support
Reply
0 Upvotes