Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Grouped reports with CDML...dream or reality?!?

Featured Replies

Hi everyone,

Is it possible to group data with CDML like we can do with summary layout in FMP?

I mean if I have 10 records witch have the same thing in my find key (ex.: 10 records in witch the field 'name' is equal to 'Christian'), is it possible to make them appears just once with all data cumulated?

Thank's to all of you!

I've used Javascript for this sort of thing.

All the best.

Garry

......and I seem to remember you gave quite a detailed explanation - have a search on the forum christianv and you'll find the post

smile.gifcool.gif

Hey Itchy you have a good memory, I had forgotten about that one at:

www.fmforums.com/threads/showthreaded.php?Cat=&Board=UBB22&Number=22831&page=&view=&sb=&o=

However, this page is more about summaries. I did have a page, a long time ago, which grouped records by a name. Not greatly different from the summary page.

Assume the found set is sorted by the 'name' field. You use a JS variable to store the 'name' field, and you keep testing it against the next record. Whenever, the value changes you can write your values to the page.

Hope this helps.

Garry

like an elephant smile.gif

itchy - nice one - just in case anyone was wondering the name is the title of an album - Scratchmalogicalwaxploitation on Ninja Tune (Cold Cut)- but the text field wasn't big enough to fit it all when i registered ...... and i though it would less of a mouthfull than Funkjazztical-Tricknology ....smile.gif - so now you know - I haven't got any skin problems ... just mental ones

cool.gif

NB: I'm still editing my posts to get the BBS to add line breaks ..... any news on a fix?

Ah the old "Funkjazztical-Tricknology", there is a little bit of up here in the hills with the hippies. Check out:

http://www.upfrontclub.org

Here is a bit of Javascript for grouping by name and adding an amount. The url is:

http://localhost:port/FMP?-db=mydb.fp5&-lay=mylay&-format=jsgroups.html&-sortfield=name&-findall

<head>

<title>JS Groups</title>

<meta name="generator" content="BBEdit 6.5.2">

<script language="Javascript">

var names = new Array();

var amount = new Array();

var i = 0;

var j = 0;

var totrecs = 0;

[FMP-Record]

names[i++] = "[FMP-Field: name]";

amount[j++] = [FMP-Field: amount];

[/FMP-Record]

totrecs = names.length ;

</script>

</head>

<body><script>document.write("Total Records = " + totrecs);</script><table>

<tr><td>Name</td><td>Amount</td></tr>

<script>

var totname = names[0] ;

var newname = "" ;

var totamount = amount[0] ;

for (var i=1; i < totrecs; i++)

{

newname = names'['i']' ;

if (newname == totname)

{ totamount = totamount + amount'['i']' ; }

else

{

document.write("<tr><td>" + totname + "</td><td>" + totamount + "</td></tr>") ;

totamount = amount'['i']' ;

totname = newname ;

}

} ;

document.write("<tr><td>" + totname + "</td><td>" + totamount + "</td></tr>") ;

</script>

</table></body>

The lack of returns in these posts is a pain. I add double returns between paras.

All the best.

Garry

p.s. remove any single quotes from the script.

The array subscripts have been stripped from the variables, even though I used the CODE markers in the post. It looks as if the "["i"]" has turned on italics. frown.gif

"names" should be "names'['i']'" - minus the single quotes.

Garry

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.