Get row item.name in lowercase and withous spaces

Hello everyone

I need to get the values of a HubDB Multi-Select-Field and set all to lowercase and remove the spaces. How is this possible in HubSpot?

Thank you so much!

{% for item in row.departments %}{{ item.name }}{% endfor %}"

@peesen , so you want to get this for each row, right? Not all the options available in the column? If so you could do it as follows:

{{ item.departments|map(‘name’)|join(’ ')|lower }} … this would replace your for loop.

Hello @dbeau79 . Yes i need to get every row of the MultiSelect Field from the HubDB. When i replace my loop with your code i get no output. Can you please help me with more details?

@peesen , Can you drop in the code for your whole table loop?

@dbeau79 Yeah for sure. This is my loop:

{% set tableId = 'team' %}

{% if tableId %}
<div class="module-team" style="margin: 0 auto;">

 <div class="team_grid_wrapper" id="myTable">
 {% set queryparam = "&orderBy=lastname&orderBy=firstname" %}

 {% set table = hubdb_table_rows('team', queryparam) %}
 {% for row in table %}
 <div class="team_block {% for item in row.departments %}{{ item.name }}{% endfor %} TEST">
 <div class="team_img">
 <span>Here comes the img</span>
 </div>
 <div class="team_text_wrapper">
 <div class="team_text"> 
 <h3>{{ row.lastname }} {{ row.firstname }}</h3>
 </div> 
 </div>
 </div> {# Team block #}
 {% endfor %} 
 </div> {# Team Grid Wrapper closed #}
</div>
{% endif %} 

Ah, try this:

{{ row.departments|map('name')|join(' ')|lower }}

(swapped “item” for “row”)

@dbeau79Thank you so much, the lowercase output is now working perfect! :slightly_smiling_face: But how can i remove the spaces inside the names? Thank you so much for all your help! I really appreciate it!

@peesen , happy to help… probably a prettier way to do this but this will work:

{{ row.departments|map('name')|join(',')|lower|replace(' ','-')|split(',')|join(' ') }}

@dbeau79Oh wow! This Version is even better than what i thought with just removing the spaces. Thank you so much for your help! Have a nice evening!