CMS Development

wmuza
Participant

Hubspot Macro now only returning 10 results from HubDB, my Switch statement returns only 10 cases

/**
* This function is used to place markers on the matching neighborhood location that is clicked on the list
*/
function setLocationLatLng(neighbourhood){

/**
*  macro to be used
*/
% macro get_data_from_table(query_base) %}
   {% set table = hubdb_table_rows(00000, query_base ) %}

   {% if table == [] %} 
        //code to exec
       {% else %}
             {% for row in table %}

                    //code to exec
             {% endfor %} 
    {% endif %}

{% endmacro %}


/**
*  javascript switch statement to call the macros
*/
switch (neighbourhood) {
case 'Upper Manhattan':
{{ get_locations_from_table('neighbourhood_locations=1') }}
{{ get_data_from_table('neighbourhood_locations=1') }}
break;

case 'The Heights': 
{{ get_locations_from_table('neighbourhood_locations=19') }}
{{ get_data_from_table('neighbourhood_locations=19') }}
break;

case 'Northwest Brooklyn':
{{ get_locations_from_table('neighbourhood_locations=9') }}
{{ get_data_from_table('neighbourhood_locations=9') }}
break;

case 'Central Brooklyn':
{{ get_locations_from_table('neighbourhood_locations=10') }}
{{ get_data_from_table('neighbourhood_locations=10') }}
break;

case 'East Brooklyn':
{{ get_locations_from_table('neighbourhood_locations=11') }}
{{ get_data_from_table('neighbourhood_locations=11') }}
break;

case 'South Brooklyn':
{{ get_locations_from_table('neighbourhood_locations=12') }} 
{{ get_data_from_table('neighbourhood_locations=12') }}
break;

case 'North Brooklyn':
{{ get_locations_from_table('neighbourhood_locations=8') }}
{{ get_data_from_table('neighbourhood_locations=8') }} 
break;

case 'Bayonne':
{{ get_locations_from_table('neighbourhood_locations=13') }}
{{ get_data_from_table('neighbourhood_locations=13') }}
break;

case 'Greenville':
{{ get_locations_from_table('neighbourhood_locations=16') }}
{{ get_data_from_table('neighbourhood_locations=16') }} 
break;

case 'Bergen/Lafayette':
{{ get_locations_from_table('neighbourhood_locations=14') }}
{{ get_data_from_table('neighbourhood_locations=14') }}
break;

case 'Downtown Jersey City':
{{ get_locations_from_table('neighbourhood_locations=15') }}
{{ get_data_from_table('neighbourhood_locations=15') }}
break;

case 'Hoboken':
{{ get_locations_from_table('neighbourhood_locations=17') }}
{{ get_data_from_table('neighbourhood_locations=17') }}
break;

case 'Journal Square': 
{{ get_locations_from_table('neighbourhood_locations=18') }}
{{ get_data_from_table('neighbourhood_locations=18') }} 
break;

case 'West Bergen':
{{ get_locations_from_table('neighbourhood_locations=20') }}
{{ get_data_from_table('neighbourhood_locations=20') }}
break;

case 'UES':
{{ get_locations_from_table('neighbourhood_locations=2') }}
{{ get_data_from_table('neighbourhood_locations=2') }}
break;

case 'UWS':
{{ get_locations_from_table('neighbourhood_locations=3') }}
{{ get_data_from_table('neighbourhood_locations=3') }}
break;

case 'Midtown East':
{{ get_locations_from_table('neighbourhood_locations=4') }}
{{ get_data_from_table('neighbourhood_locations=4') }}
break;

case 'Midtown West':
{{ get_locations_from_table('neighbourhood_locations=5') }}
{{ get_data_from_table('neighbourhood_locations=5') }}
break;

case 'Downtown':
{# get_locations_from_table('neighbourhood_locations=6') #}
{{ get_data_from_table('neighbourhood_locations=6') }}
break;

case 'Financial District':
{{ get_locations_from_table('neighbourhood_locations=7') }}
{{ get_data_from_table('neighbourhood_locations=7') }}
break;

case 'Battery Park City':
{{ get_locations_from_table('neighbourhood_locations=7') }}
{{ get_data_from_table('neighbourhood_locations=7') }}
break;

default:
{{ get_data_from_table('neighbourhood_locations=19') }}
break;
}

}
0 Upvotes
4 Replies 4
Adesignl
Top Contributor | Partner
Top Contributor | Partner

Hubspot Macro now only returning 10 results from HubDB, my Switch statement returns only 10 cases

in your request end point add 

&limit=100

or what ever number you desire.

0 Upvotes
lscanlan
HubSpot Alumni
HubSpot Alumni

Hubspot Macro now only returning 10 results from HubDB, my Switch statement returns only 10 cases

Hi @wmuza,

 

Could you link me to this one? A link to a live page where you've got this set up, or a link to a module or page in-app where you've got it set up. You shouldn't be getting limited to just 10 table rows per table query, but I think I'll need to see the setup itself to understand why that's happening. I'll need to understand the get_locations_from_table() macro as well as any filter being applied, and then compare that to what I'm seeing in the table.

 

Thanks,

Leland

Leland Scanlan

HubSpot Developer Support
0 Upvotes
wmuza
Participant

Hubspot Macro now only returning 10 results from HubDB, my Switch statement returns only 10 cases

0 Upvotes
lscanlan
HubSpot Alumni
HubSpot Alumni

Hubspot Macro now only returning 10 results from HubDB, my Switch statement returns only 10 cases

Hi @wmuza,

 

I think maybe I misunderstood initially how you were pulling in your table rows. I can see now that you're making requests directly to the API from your page. And in that case, our documentation does state under rate limits:

 

A limit of 10 unique queries per page

Although I think I'm seeing your map pull in the data correctly each time. Is that not happening for you? Could you also make one request for the entire table and then filter on the cached response when clicking into the different neighborhoods?

 

 - Leland

Leland Scanlan

HubSpot Developer Support
0 Upvotes