April 24, 200322 yr Hi I want to be able to simulate a 'Sub-Summary When Sorted By...' on my results page. I want them sorted and summarized by category ie. Cat1 record record record Cat2 Record Record..... etc I was adivsed that this could be done with a java script, to do the summarizing, post CDML processing. Is this possible? Does anyone know of such a script?? Be cool Halbj
April 24, 200322 yr Welcome back OK, If you sort by "category" you could do something like this: <script> sCat = ""; [FMP-Record] if (sCat == "[FMP-Field:category]") { document.write("[FMP-Field:myfield]<br>"); } else { sCat = "[FMP-Field:category]"; document.write("<b>[FMP-Field:category]</b><br>"); document.write("[FMP-Field:myfield]<br>"); }; [/FMP-Record]</script> Something like this will do the job. All the best. Garry
April 28, 200322 yr Author That works well Garry, Just wondering if the script could be modified to put results fields 1 2 &3 into a table. ie Cat1 <tr> <td>field1</td><td>field2</td><td>field3</td> </tr> Does this make sense? Cheers Hal.
April 28, 200322 yr You can do something like this: <script> sCat = ""; [FMP-Record] if (sCat == "[FMP-Field:category]") { document.write("<tr><td> </td><td>[FMP-Field:field1]</td><td>[FMP-Field:field2]</td><td>[FMP-Field:field3]</td></tr>"); } else { sCat = "[FMP-Field:category]"; document.write("<tr><td><b>[FMP-Field:category]</b></td>"); document.write("<td>[FMP-Field:field1]</td><td>[FMP-Field:field2]</td><td>[FMP-Field:field3]</td></tr>"); }; [/FMP-Record]</script> All the best. Garry
April 28, 200322 yr Author ...... OK - I got that working with the following code. <script> sCat = ""; [FMP-Record] if (sCat == "[FMP-Field:SectionHeading3]") { document.write("<table><tr><td>[FMP-Field:PrecedentLink]</td><td>[FMP-Field:type1]</td></tr></table>"); } else { sCat = "[FMP-Field:SectionHeading3]"; document.write("<b>[FMP-Field:SectionHeading3]</b><br>"); document.write("<table><tr><td>[FMP-Field:PrecedentLink]</td><td>[FMP-Field:type1]</td></tr></table>"); }; [/FMP-Record]</script> But....... If I try and add "table width" and 'border" attributes to the <table> tag, I get a blank results screen. In addition to this, the field "PrecedentLink" is a calculation that;s result is a string that is '<a "http://10.10.10.10/data">data</a>'. becuase of this I need [FMP-Field:PrecedentLink] to be [FMP-Field:PrecedentLink,Raw]. But when I add the ',Raw' to the tag, I get a blank results page. Any ideas on how I can acheive the raw encoding on the field and the table border? Cheers Hal.
April 28, 200322 yr Re: "table width" and 'border" attributes to the <table> tag, I get a blank results screen. Check wether you are using " instead of '. Re: <a "http://10.10.10.10/data">data</a> Should be <a href='http://10.10.10.10/date'>data</a> Trying to match " and ' pairs can be a bit of a trap (and a pain). Good Luck. Garry
April 28, 200322 yr Author hmmmmmm... I am still unable to get the 'link' field to process as raw - I still get a blank results page. Here is my code.. <script> sCat = ""; [FMP-Record] if (sCat == "[FMP-Field:SectionHeading3]") { document.write("<table border='1'><tr><td><p>[FMP-Field:PrecedentLink, Raw]</P></td><td>[FMP-Field:type1]</td></tr></table>"); } else { sCat = "[FMP-Field:SectionHeading3]"; document.write("<b>[FMP-Field:SectionHeading3]</b><br>"); document.write("<table border='1'><tr><td><p>[FMP-Field:PrecedentLink, Raw]</P></td><td>[FMP-Field:type1]</td></tr></table>"); }; [/FMP-Record]</script> And here is a sample of the processed page code.. document.write("<table border='1'><tr><td><p><a href= 'http://10.70.10.8/precedents/p61851828.doc'>Food court provision</a></p></td><td>Deed / Agreement</td></tr></table>"); Any ideas? I have tried all combinations of "xx" and 'xx'. Is there a 'general' rule when dealing with them? Cheers Hal.
April 28, 200322 yr The only thing I can see is this: <a href= 'http://10.70.10.8/precedents/ There is a space between = and 'http. Try removing this to see if there is any difference. Good Luck. Garry
April 29, 200322 yr Author ..Still no good. If I specify 'Raw' my results page is still blank. If I view the source code of the processed page and copy the generated code in the 'document.write("generated_code") ', then paste it into a web page, the browser processes it as requested - wierd?
April 29, 200322 yr I have had problems with the odd carriage-return in the field. They should not have been there, however some users happened to press return when they finished entering the data. What happens when you do not use "raw". Also, can you use controlled data; that is only one or two records with data you have absolute control over. Good Luck. Garry
April 29, 200322 yr Those "odd carriage-return in the field" are worst enemy of JavaScript. For Web serving/displaying I am using another Calculation field with CR filtered out.
May 1, 200322 yr Author when I do not use 'raw' it writes that text to the screen eg <a href='http://10.70.10.8/precedents/p61495362.doc'>Manager & Licensee Guidelines Beer Producer</a> for each record. I am using good data, and always using the same set (of about 95 records) when testing. I am sooo close, yet so far..... H
May 1, 200322 yr Try this: document.write("<table border='1'><tr><td>" + escape("[FMP-Field:PrecedentLink, Raw]") + "</td><td>[FMP-Field:type1]</td></tr></table>"); I have added the "escape()" function. Also, I have removed the <p></p> tags. Good Luck. Garry
Create an account or sign in to comment