Jul 27, 2021 4:36 PM
I'd like to limit the number of loops so it doesn't show more than 10 records. I've tried adding the range function but I'm not exactly sure where to put it. Thanks for you help.
{% set contact_id = contact.hs_object_id %}
{% set associated_objects = crm_associations(contact_id, 'USER_DEFINED', 30, 'orderBy=account_row_id', 'account_row_id,acct_uom,acct_commodity,lastmonth_date,lastmonth,thismonth_date,thismonth,month1,month1_date,month2,month2_date,month3,month3_date,month4,month4_date,month5,month5_date,month6,month6_date,month7,month7_date,month8,month8_date,month9,month9_date,month10,month10_date,month11,month11_date') %}
{% for energyresi in associated_objects.results %}
All my html
{% endfor %}
Solved! Go to Solution.
Jul 28, 2021 1:32 AM
Hello @EJackson23,
I would recommend limiting the results by 10 objects only, and you can do that like this example -
{% set associated_objects = crm_associations(contact_id, 'USER_DEFINED', 30, 'limit=10&orderBy=account_row_id', 'account_row_id,acct_uom,acct_commodity,lastmonth_date,lastmonth,thismonth_date,thismonth,month1,month1_date,month2,month2_date,month3,month3_date,month4,month4_date,month5,month5_date,month6,month6_date,month7,month7_date,month8,month8_date,month9,month9_date,month10,month10_date,month11,month11_date', false) %}
I hope this helps,
Have an amazing day ahead!
Jul 28, 2021 9:51 AM
Hi @EJackson23 ,
This function returns an object with the following attributes: has_more, total, offset and results.
You can pass offset number in association hubl function:
Screen shot : https://prnt.sc/1gzol30
Please have look this documentation :
https://developers.hubspot.com/docs/cms/hubl/functions
Example :
{% set associated_objects = crm_associations(<contact_vid>, 'USER_DEFINED', 30, 'offset=<offset_interger>', false) %}
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.
Jul 28, 2021 1:32 AM
Hello @EJackson23,
I would recommend limiting the results by 10 objects only, and you can do that like this example -
{% set associated_objects = crm_associations(contact_id, 'USER_DEFINED', 30, 'limit=10&orderBy=account_row_id', 'account_row_id,acct_uom,acct_commodity,lastmonth_date,lastmonth,thismonth_date,thismonth,month1,month1_date,month2,month2_date,month3,month3_date,month4,month4_date,month5,month5_date,month6,month6_date,month7,month7_date,month8,month8_date,month9,month9_date,month10,month10_date,month11,month11_date', false) %}
I hope this helps,
Have an amazing day ahead!
Jul 29, 2021 9:04 AM
Thank you Himanshu. This worked great.