Counted Records

M

Mike

Hi, Is there any way to show the correct count of records for a repeating
table with no records in it yet. example Number of Check shows as 1 instead
of 0 in the form as well as when submitted to the database even though no
data was entered for checks.

Thanks
 
A

Andrew Watt [MVP - InfoPath]

Hi, Is there any way to show the correct count of records for a repeating
table with no records in it yet. example Number of Check shows as 1 instead
of 0 in the form as well as when submitted to the database even though no
data was entered for checks.

Thanks

Mike,

The count you are seeing is correct because InfoPath is counting the
number of rows/cells in the repeating table.

So you need a formula that counts cells that are not empty. So you
need an XPath predicate that only matches cells/rows with the
particular data empty.

Something like this should do it for a single cell bound to field3 in
the row being empty:
count(../my:group1/my:group2/my:field3[not(. = "")])

Andrew Watt
MVP - InfoPath
 
A

Andrew Watt [MVP - InfoPath]

Hi, Is there any way to show the correct count of records for a repeating
table with no records in it yet. example Number of Check shows as 1 instead
of 0 in the form as well as when submitted to the database even though no
data was entered for checks.

Thanks

Mike,

The count you are seeing is correct because InfoPath is counting the
number of rows/cells in the repeating table.

So you need a formula that counts cells that are not empty. So you
need an XPath predicate that only matches cells/rows with the
particular data empty.

Something like this should do it for a single cell bound to field3 in
the row being empty:
count(../my:group1/my:group2/my:field3[not(. = "")])

Andrew Watt
MVP - InfoPath

Should be NOT empty in the line before the XPath formula.

Andrew Watt
MVP - InfoPath
 
M

Mike

Thanks Andrew, it worked perfectly. I also found out that there is a filter
wizard when entering formulas.

Mike

Andrew Watt said:
Hi, Is there any way to show the correct count of records for a repeating
table with no records in it yet. example Number of Check shows as 1 instead
of 0 in the form as well as when submitted to the database even though no
data was entered for checks.

Thanks

Mike,

The count you are seeing is correct because InfoPath is counting the
number of rows/cells in the repeating table.

So you need a formula that counts cells that are not empty. So you
need an XPath predicate that only matches cells/rows with the
particular data empty.

Something like this should do it for a single cell bound to field3 in
the row being empty:
count(../my:group1/my:group2/my:field3[not(. = "")])

Andrew Watt
MVP - InfoPath
 

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