Count Matcing Fields

Count Matcing Fields

  
Hello,
 
I am trying to see if there is a way to add a counting function on a list page. I need each record in the list page to have a field or text that shows me how many records with the same matching field there are. I added a “matching field” to each record, which tells me and allows me to search for some records that are related to each other. To make it a little more complex, I have a query that eliminates the duplicate matching results in the list view, but I would still want those hidden results counted. I thought it may help to illustrate it a little bit to help make it more clear haha.

LIST VIEW PAGE:
 
FIELD 1                   FIELD 2                                FIELD 3
Abc 123                asdklfjas;ldfk                          5656                 Record Count: 2
def 456                qweqws;ld43                           5656                 Record Count: 2 (hidden result)
ghi789                  uodklfjas;ld67                         123                   Record Count: 4
jkl 123                  lwdklfjas;ldew                          123                   Record Count: 4 (hidden result)
mno 123              dfdferdfgldvb                            123                   Record Count: 4 (hidden result)
pqr123                 asdklfjas;ldkl                            123                   Record Count: 4 (hidden result)

Is this possible?
Thanks,
Mark
Hey Mark:

I need a little bit more context to help so It would be great if you can aswer the following questions:
- Is this a database table you are counting?
- What are the fields that you are matching? Is it Field 3?
- How do you decide when to show Abc 123  or Abc 123?

One of the easiest ways (though not the most performant) is to show the records you need to show and then define an action that counts the number you want. If you define that action as a funcion (set the function property to yes), you can then set an expression in your line that call the fucntion, passes the parameter and displays the count. Please not that this function will be called for each line you display.

The other way, if you are dealing with a db table is to do an avanced query.

Please give us some more details.

Cheers:

    MIguel
Hi Miguel,
 
-It is a database table that I am counting.
-Field 3 is the matching field.
-The query is setup to hide results that have “no” in field 4.
 
FIELD 1                   FIELD 2                                FIELD 3              FIELD 4              What I would like displayed:
Abc 123                asdklfjas;ldfk                          5656                                                Record Count: 2                                       1
def 456                qweqws;ld43                           5656                   NO                       (hidden result so not shown)                  = 2
ghi789                  uodklfjas;ld67                         123                                                  Record Count: 4                                       1+
jkl 123                  lwdklfjas;ldew                          123                    NO                        (hidden result)                                          2
mno 123              dfdferdfgldvb                            123                    NO                        (hidden result)                                          3

pqr123                 asdklfjas;ldkl                            123                    NO                       (hidden result)                                           =4


Thanks for your time,
Mark
 
Hi Mark:

There are two ways of doing this:

1- Create an advanced query like 

    Select {Entity}.[Field 3], count({Entity}.[Id])
    From  {Entity}
    Group by {Entity}.[Field 3]

    And then you need to decide what to show for field 1 and field 2 (maybe a simple query that has all the Field 4 <> 'NO' and the merge the two lists with two foreach)

2- A simple query that has all the Field 4 <> 'NO'  and then a function that takes the Field 3 value of the record and returns the count of a simple query where field 3 = value. You would place this function in an expresion in the end of each line passing the field 3 value.

Maybe if you can explain the exact use case I will be able to shed some more light on the issue. I find it strange that you are hiding the other records and still displaying field 1 and field 2 of the first one... It seems like  field 1 and field 2 should be the same for you to aggregate them.

Cheers:


        Miguel