Counting repeating section

W

Wenster

I'm a fairly novice user with little code experience. I have a repeating
section and within the section is a table. In the first cell of the table I
used an expression box to number that table - I used position(). This allows
me to number each section as a user adds it to the form.

However, I'd like to also be able to add a way to say this is table N of N.
So that the second value is the total number of tables added.

Can anyone explain how I can do this?

thanks!
 
S

Swathi

Hi,
Take a hidden field whose default value is count(group2).
Here group2 -> repeating section.
You will get the number of repeating sections you have. Concat this value
with the position().
Hope this helps to you.
 
W

Wenster

I'm not sure what I'm doing wrong, but it's not working. The result of the
count function is 1 - not matter how many repeating sections I enter into the
form. The result of the position function is 11 - i'm not sure where that's
coming from : (
 
S

Swathi

Hi,
Use the following expression as default value in the text box where you want
to show the values.

concat(count(../preceding-sibling::my:group4) + 1, " of ",
count(/my:myFields/my:group1/my:group2/my:group3/my:group4))
Here group4-> repeating table.

For that use the following steps.
1.Open the text box properties.
2.Click on fx button in default value.
3.Insert the above expression in ‘Insert formula’ window.

I have tested this and it is working fine.
 
W

Wenster

I'm still unable to grasp how to make this work. Unfortunately I don't
understand the example provided.

Here's what I have:
expression box with formula - position() --- this gives me the ability to
increment each section as a user adds it.

I also want to be able to count how many sections a user adds and ensure
that all the added sections use the same count.

So if 1 section is entered into the form - Slide 1 of 1

If another section is added to the form Slide 1 changes to reflect - Slide 1
of 2 and Slide 2 shows Slide 2 of 2. Again, I've used an expression box to
create the "Slide x" piece and i cannot figure out how to get the second
number.

My data source looks like this:
myfields
--Slides General (Group)
--Slide Properties (repeating group)
--Slide Total (field)

Slide Total is the field that I am trying to use to calculate total number
of repeating sections that a user adds.

Your help is much appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top