Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 8292 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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!

Posted

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

Posted

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?

Posted

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.

Posted

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

This topic is 8292 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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