count the number of filtered row

V

virgul

Hi,

I wan't to count the number of result which is filtered by my filter in
a repetitive section.

The probleme is that I can see the total of the occurence in my form
with count()

But If I wan't to count the section that appear on the screen( not the
other (hide)) how I can to do that?

Any ideas?

Thanks in advance for your answer!

++

Thierry
 
S

Scott L. Heim [MSFT]

Hi Thierry,

You will need to apply a "WHERE" clause to the expression that provides you
with the "count". For instance, my sample is setup as follows:

- Bound to the Northwind Orders table
- I enter a CustomerID as the query field and the resulting orders are
displayed in Repeating Sections (one of the fields is ShipVia, which
displays the ShipperID)
- I have a drop-down box that is bound to the Northwind Shippers table and
shows the ShipperID
- The expression in my field to display the count was originally the
following:

count(dfs:dataFields/d:Orders)

However, I modified it to this and it now displays a count of just those
records displayed on the form:

count(dfs:dataFields/d:Orders[@ShipVia = //dfs:myFields/my:txtShipper])

I hope this helps!

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Scott L. Heim [MSFT]

Hi Thierry,

One other item that may be of interest: if you want to have your expression
display the total number of records *before* the user applies the filter
(but after a query is executed) and then change to the number of records
shown on the form *after* the filter is applied, here is how you could
accomplish that behavior:

- Have one field that has the expression:

count(dfs:dataFields/d:Orders[@OrderID != ""])

** NOTE: In my sample, OrderID is one of the fields in my Repeating
Section. If you don't use this type of clause, then the expression will
show a count of 1 when the form is initially opened.

- Have another field with the expression I provided in my prior post:

count(dfs:dataFields/d:Orders[@ShipVia = //dfs:myFields/my:txtCity])

- Add "Conditional Formatting" to each of these fields similar to the
following:

- For the first field noted above, I have an expression that is basically:
if the count of my "Orders" group > 0 then hide this field
- For the second field noted above, I have an expression that checks to
see if my filter drop-down box "is blank" - if so, I hide this field.

Both of these fields are next to each other on my form so only one gets
displayed at a time. So when I initially open my form, the filter box is
empty and the count of my "Orders" is 0 so the first field is displayed
with a value of 0. Once I execute a query to return records, the count of
my "Orders" is now > 0 so I still show the first field but with the total
number of records returned. Lastly, once I apply a filter, my filter
drop-down box is no longer "blank" so my first count box is now hidden and
the second is made visible with a total of just the filtered records!

Whew...I hope all this makes sense!! :)

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
V

virgul

Sorry for my late reply and thanks for your answer it's very great !

But this week I have no time for make I would try the next week if that
work and I give my result.

But I don't know if that work if the data is a xml load in the load of
fomular so I have 700 results?

In all the case thanks for have take to explain me two different way to
make my goal!

++

Thierry
 

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