May 15, 200223 yr 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!
May 19, 200223 yr ......and I seem to remember you gave quite a detailed explanation - have a search on the forum christianv and you'll find the post
May 20, 200223 yr 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
May 20, 200223 yr like an elephant 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 .... - so now you know - I haven't got any skin problems ... just mental ones NB: I'm still editing my posts to get the BBS to add line breaks ..... any news on a fix?
May 21, 200223 yr 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.
May 21, 200223 yr 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. "names" should be "names'['i']'" - minus the single quotes. Garry
Create an account or sign in to comment