Hi everyone! For future reference, this topic describes how to use DREL with repeatable, nested sections. Please note the use of %e versus %a: DREL for Repeatable Sections (prontoforms.com)
Original Message:
Sent: 08-30-2023 03:44
From: Stephen Morrison
Subject: DREL to extract single data from repeatable footer (aggregate question)
Calvin
Brilliant. Many thanks for investing the time to look into this. Thank you on three fronts:
- You found a solution that works;
- Your analysis confirms that I hadn't missed anything obvious in pursuit of a solution;
- Will to live restored!
Many thanks again for taking the time - you have to love the PF Community!
Thanks
Stephen
------------------------------
Stephen Morrison
Business Information and Performance Director
BCA Insulation
Original Message:
Sent: 08-29-2023 16:59
From: Calvin Hunter
Subject: DREL to extract single data from repeatable footer (aggregate question)
Figured this would be an easy answer but boy was I wrong. It seems like when you look at footer questions, DREL is not returning the selected index - it will always return the full array.
%a[Paintings][0] or %e[Rooms][0][%a[Paintings]] returns
It should return 15, but apparently not. I did confirm it returns an actual array by adding a delimiter
%a[Paintings][0][, ] returns:
So it's not just returning a string.
After a ton of experimentation I was able to get an array that is accessible by index.
I found that each CHILD section contains the footer question data for the parent section it belongs to - and that can be accessed by index.
%e[Parent][INDEX][%e[Child][0][%a[Question][0]]]
OR
%e[Rooms][0][%e[Walls][0][%a[Paintings][0]]]
This will return
The [Rooms] index is the one you need to change to get values for each room.
%e[Rooms][1][%e[Walls][0][%a[Paintings][0]]] will return:
Paintings must have an index but it doesn't matter what index you give it. The walls index can be anything up to the number of Walls in that Room, but they are all the same value, so 0 works.
I'm guessing it's just a bug with the DREL engine not recognizing the index provided. %a[Paintings][0] and/or %e[Rooms][0][%a[Paintings]] should just work.
Hope this helps and/or restores your will to live.
------------------------------
Calvin Hunter
Project Manager
Vipond Inc
MB
Original Message:
Sent: 08-28-2023 11:43
From: Stephen Morrison
Subject: DREL to extract single data from repeatable footer (aggregate question)
Hi Community
Hoping for a little guidance / sign posting before I lose the will to live... I have spent the whole day trying to figure out how to get one item of data into my custom excel doc and have to put my hands up in defeat - I've been through the University and online documentation an cannot find a solution that works. I have used custom Excel docs for years and get them to work without any issues but this one has me stumped...
I have a nested repeatable section:
- Standard section 1: Collects data for a house (address, etc.)
- Repeatable Section 2 : Defines the size and name of each room in a house (multiple rooms)
- Nested Repeatable Section 3 (subset of 2) : Defines the size and details of a wall in the above room (multiple Walls). Data collected includes the number of "paintings" on each wall (not really paintings but using for simplicity)
Using %a[FieldName][1] etc I can get the names of the rooms listed separately on my excel sheet. Next to that I want to have the number of paintings within that room. This number is recorded in the footer collected via the aggregate function.
When I use %a[Paintings] or %a[Paintings][1] the output is the data for all rooms:
I am trying to single out each number but having no joy.
Is it because the field is calculated in the footer or am I missing something else?
Appreciate any help/guidance.
Thanks
Stephen
------------------------------
Stephen Morrison
Business Information and Performance Director
BCA Insulation
------------------------------