Forums
Extending Daylite
Building Reports and Print Layouts
Adding TOTAL field to count no. of contacts in table|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Apprentice |
Hi,
I don't think this is currently possible but just want to double check: I want to create a 'statistical report' which contains several tables - each doing a different search of contacts (under Table Attributes > Data). For each table I only want to display the summary row, and in each summarty row I want to do a count of how many contacts were brought back by the search. Is there a way to have a 'total' field that counts the number of contacts (or other object)?? At first I thought I could use '@sum.cachedTotalAmount' but then i realised this only adds up the numerical values of the field it is attached to - it doesn't do a count of the rows of data returned in the table. Any help would be greatly appreciated - even if it only confirms that this is not possible (so i can ask Marketcircle to include it!!) Thanks! Lee |
||
|
|
Apprentice |
Maybe I could run a SQL query (instead of using the builtin query editor) and include the 'COUNT' function in my SQL query - so I bring back a count on the number of rows (ie. no. of contacts). This is opening a can of worms though (I haven't written SQL queries for years) and I'm not sure where I would put the query in the report(on a field? on the table?).
Any thoughts from anyone? Thanks. Lee |
|||
|
|
Marketcircle Team |
This can be done. The trick is to count the results array.
So in a token in the summary row, you'd have the following keypath: enclosingReportTable.reportData.objects.count (add any token, then just manually adjust the keypath) enclosingReportTable is the same as parent.parent in this case - it's just more direct. If you want to do some real crazy statistical stuff, you can do a lot with F-Script (like area under a curve and what not). F-Script is an array based language so it lends itself to this kind of stuff (among other things). The method I outlined above is costly in that it fetches the objects and then does a count. You can do a lot more efficient counts using F-Script. See the Activity By Week report I put in the Share Zone. It does a lot of the direct count stuff. |
|||
|
|
Marketcircle Team |
You might be wondering 'how the heck would I have known to use count?'. The answer is to look in the Cocoa documentation - under NSArray.
Our Dev and Report docs (the real technical stuff) reveal that the reportData.object on the table is an 'array'. This thread also has some fancy calculation stuff. |
|||
|
|
Apprentice |
Thanks AJ - I'll put your advice to work and see how I go! Lee
|
|||
|
|
Apprentice |
'enclosingReportTable.reportDate.objects.count worked a treat (I decided to use this over F-script - I will have to put off learning F-Script until my desk clears a bit!).
HOWEVER I don't want the Data Row of the table displaying (ie. I don't want to list the contacts, I just want to print a series of counts based on different search criteria in different tables). I know the Data Row is mandatory but hoped I could 'hide it' - I've removed all text boxes from the Data row and also unticked it in the Elements Outline. But i now get a big patch of blank space (where the contacts would normally appear) before the summary (count) row appears. Help!!??! Thanks! Lee |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|
Forums
Extending Daylite
Building Reports and Print Layouts
Adding TOTAL field to count no. of contacts in table
