What is basically the same approach but using smaller utilities strbracketF =: 0&{::@:[ , ] , 1&{::@:[ strbracket =: (0&({)@:[ , ] , 1&({)@:[)
('<table>';'</table>') (strbracketF >) ('<tr>';'</tr>')strbracket"1 (<'<td>';'</td>') strbracketF each ": each <"0 i.3 4 makes a lot of extra whitespace in result, but layout is readable. There is a copy/paste reusability for including formatting attributes and other tweaks ----- Original Message ----- From: Devon McCormick <devon...@gmail.com> To: J-programming forum <programm...@jsoftware.com> Cc: Sent: Tuesday, March 3, 2015 1:37 PM Subject: Re: [Jprogramming] Transform boxed data to html representation I like Raul's and Joe's approaches better than the one I proposed. However I might modify, say Joe's version, to add some formatting like this: buildTable =: 3 : 0 cols =. ,"2 ('<td>'&,@]@,&'</td>') every y rows =. , TAB,"1 LF,~"1('<tr>'&,@]@,&'</tr>')"1 cols table =. '<table>',LF,rows,'</table>' ) So (this probably won't survive gmail formatting but you can try it yourself): buildTable data <table> <tr><td>abc</td><td>ab</td> <td>xyz</td><td>abc</td></tr> <tr><td>ab</td> <td>xyz</td><td>abc</td><td>ab</td> </tr> <tr><td>xyz</td><td>abc</td><td>ab</td> <td>xyz</td></tr> </table> On Tue, Mar 3, 2015 at 11:12 AM, Joe Bogner <joebog...@gmail.com> wrote: > How about something like this? > > NB. some data that is slightly offset > data=. 3 4 $ ;: 'abc ab xyz' > > buildTable =: 3 : 0 > cols =. ('<td>'&,@]@,&'</td>') every y > rows =. , ('<tr>'&,@]@,&'</tr>')"2 cols > table =. '<table>',rows,'</table>' > ) > > buildTable data > > On Tue, Mar 3, 2015 at 9:40 AM, Chernin, Nadav <chern...@corning.com> > wrote: > > > Hi, > > I need in my project to represent boxed data in html report > > I try to find some code that can help me to do that > > Thanks > > > > Nadav Chernin > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm