# Unwanted white spaces when using nested repeating groups

When creating PDFs of long repeating groups (i.e. when the height of the repeating group is > 1 page of the PDF), we recommend using the square bracket approach \[] outlined in [this section](https://cranford-tech.gitbook.io/pdf-creator/tips/generating-pdfs-of-repeating-groups-that-span-multiple-pages) of the plugin documentation.

However, if you're creating a PDF of a **nested** repeating group you may still encounter unwanted white spaces.

The solution is to take the square bracket \[] approach and apply it to the nested repeating group. This takes a bit of extra work as you will typically have an unknown/variable number of repeating group cells that you need to add to your PDF

### Solution

The generatl approach is:

* Add ID attributes to each of the nested repeating groups
* Add square brackets ('\[' and ']') to each of those nested repeating groups

\
You can use the '**format as text**' and '**split by**' operators to get a list of the nested repeating groups. In the example below, I have a repeating group ('menucategory') with a nested repeating group ('menuitem'):<br>

![Screenshot 2024-03-26 at 09.34.10.png](https://mail.google.com/mail/u/0?ui=2\&ik=3d7763e25a\&attid=0.4\&permmsgid=msg-a:r-2799281472094031679\&th=18ec2fb99091cfb0\&view=fimg\&fur=ip\&permmsgid=msg-a:r-2799281472094031679\&sz=s0-l75-ft\&attbid=ANGjdJ9aiCxDE_epSAkyC5pNLUyo01UxzUhYFznpS1XxDgF21xcwd7QVphumr9Z5kffrECcKxm1tl_WZ4I72h4rOhHTSDTWcW2wRSqDGlHpZozdl3et3bg3fN-QRw0M\&disp=emb\&realattid=ii_lu86njh75\&zw)

\
I've assigned the ID attribute \[menuitem-Parent group's Menu Item's unique id] to the nested repeating group.<br>

![Screenshot 2024-03-26 at 09.39.21.png](https://mail.google.com/mail/u/0?ui=2\&ik=3d7763e25a\&attid=0.6\&permmsgid=msg-a:r-2799281472094031679\&th=18ec2fb99091cfb0\&view=fimg\&fur=ip\&permmsgid=msg-a:r-2799281472094031679\&sz=s0-l75-ft\&attbid=ANGjdJ-rOjoUTaN_vvSNAsMXlq_iLa24quY3OmeeSjvmSRglOVVn4zXC3FYK_2U45LJ4-eVpGlNIl5NzRcBb-Xbgq3FPnoeItZQCsyEpoJ4SagQ8FlAwYder891epBk\&disp=emb\&realattid=ii_lu86rus06\&zw)

\
Given there are two menucategory repeating groups on this page, we want to be able to dynamically get"

* \[menuitem-uniqueIDxxx]

<figure><img src="https://mail.google.com/mail/u/0?ui=2&#x26;ik=3d7763e25a&#x26;attid=0.7&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;th=18ec2fb99091cfb0&#x26;view=fimg&#x26;fur=ip&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;sz=s0-l75-ft&#x26;attbid=ANGjdJ_eDTLa8doUEnssABEN4Cj5Q2X9uG4mnRQysPCKZgK39HULkOMnkrl3Pd9yWTH630KElv0b22-hKiSoGMp5xApl7H4eJOGZIpqh_eob0IPrIC9M_YgwJ0j0P00&#x26;disp=emb&#x26;realattid=ii_lu86vkae7&#x26;zw" alt=""><figcaption></figcaption></figure>

* and \[menuitem-uniqueIDyyy]

<figure><img src="https://mail.google.com/mail/u/0?ui=2&#x26;ik=3d7763e25a&#x26;attid=0.2&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;th=18ec2fb99091cfb0&#x26;view=fimg&#x26;fur=ip&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;sz=s0-l75-ft&#x26;attbid=ANGjdJ9VSXwSSBAnB2s0FHqeIAmNl8bx6w9-5QJ7TkcEOn8MjBXxSb6xjdrPGzMWT4hvwHi35Rv83bEhEb5XSb-GFEnE84LqZiCpNrEMzu8QIVQyZpzvwYaZ-Ak1WkE&#x26;disp=emb&#x26;realattid=ii_lu86vtw98&#x26;zw" alt=""><figcaption></figcaption></figure>

\
We can use the following dynamic expression to get that:<br>

<figure><img src="https://mail.google.com/mail/u/0?ui=2&#x26;ik=3d7763e25a&#x26;attid=0.3&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;th=18ec2fb99091cfb0&#x26;view=fimg&#x26;fur=ip&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;sz=s0-l75-ft&#x26;attbid=ANGjdJ-kaO1JWyGGA-nPOe0AMk_ZNf_pxIQPm6oyagDQfBmWO6vnnrvFsKxX49iAW6JNRa2iyX6HFJ-ef9BFIUWZ1rIEdObcdUfyPAEedASGtMjQFPgRj1Q5T78TBWQ&#x26;disp=emb&#x26;realattid=ii_lu86wy6e9&#x26;zw" alt=""><figcaption></figcaption></figure>

\
Where the 'format as text:' is the following:<br>

<figure><img src="https://mail.google.com/mail/u/0?ui=2&#x26;ik=3d7763e25a&#x26;attid=0.5&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;th=18ec2fb99091cfb0&#x26;view=fimg&#x26;fur=ip&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;sz=s0-l75-ft&#x26;attbid=ANGjdJ9IBm7taHdigoW37S6UQmxOiphoxSsBlmfE59fF06_jsyxtRj0DWETiV_XJGAjvE5s_L9qX-s1rRnOL35_TBE-Hy37vqx-yRg2dvccmK3kc3G291OUAPm7GjOw&#x26;disp=emb&#x26;realattid=ii_lu86xhk210&#x26;zw" alt=""><figcaption></figcaption></figure>

and we use a comma for the 'split by'.<br>

By adding this expression to our 'Generate PDF Creator' action, we can target all of the relevant nested repeating groups without knowing how many of them there will be.<br>

<figure><img src="https://mail.google.com/mail/u/0?ui=2&#x26;ik=3d7763e25a&#x26;attid=0.8&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;th=18ec2fb99091cfb0&#x26;view=fimg&#x26;fur=ip&#x26;permmsgid=msg-a:r-2799281472094031679&#x26;sz=s0-l75-ft&#x26;attbid=ANGjdJ8GGo-wugcNEdcw5UXTaa2aQws0ZREKrcSAiTkbeH-CcnSB6CuQEiCUhpE9JNqvFCwHVMxqEqcvajw43iXUnZ-ab8hzhKOXWkYpB2sWMlUTtRPcJ5itJo3BdtQ&#x26;disp=emb&#x26;realattid=ii_lu870eql11&#x26;zw" alt=""><figcaption></figcaption></figure>

You can see the setup used in the above example [here](https://bubble.io/page?type=page\&name=nested-rg-example\&version=test\&id=pdf-creator-demo\&tab=tabs-1).<br>
