Which record do you want to include for the repeated dates? the first, or last?
Julian http://sensei.zenunit.com/ http://random8.zenunit.com/ On 28/01/2009, at 1:50 PM, Shankar Ganesh wrote: > > Hi, > > I got a table like this > > --------------------------------------------------------------- > id | what | when | color | to | description | > --------------------------------------------------------------- > 1 | test |01/01/2009 | red |04/01/2009 | hi this is test | > --------------------------------------------------------------- > 2 | test2 |02/01/2009 | green |04/01/2009 | hi this is test | > --------------------------------------------------------------- > 3 | test3 |01/01/2009 | blue |04/01/2009 | hi this is test | > --------------------------------------------------------------- > 4 | test4 |02/01/2009 | orange |04/01/2009 | hi this is test | > --------------------------------------------------------------- > > I had fetch the value from the database in such a way like this > > ############################## > #[JavaScript source with ROR]# > ############################## > > var dAb = new Array(); > var x = 0; > var event_task_today =''; > var event_task =''; > > <% @eventall.each do |d| %> > var DBdate1 = '<%= d.when%>'; > var eventdate1 = DBdate1.split('/'); > var task_date1 =eventdate1[2]+eventdate1[1]+eventdate1[0]; > dAb[x++] = task_date1+" <div align='lef' > style='background:<%=d.color%>;color:white;'><%= d.what%></div>"; > <% end %> > > If I alert 'dAb'value I'm getting like this > ***** > > 20090101 <div align='left' > style='background:red;color:white;'>test</div>,20090102 <div > align='left' style='background:green;color:white;'>test2</div>, > 20090101 > <div align='left' > style='background:blue;color:white;'>test3</div>,20090102 <div > align='left' style='background:orange;color:white;'>test4</div> > > I need to have JavaScript variable 'dAb'like this > ******** > > 20090101 <div align='left' > style='background:red;color:white;'>test</div><BR><div align='left' > style='background:blue;color:white;'>test3</div>,20090102 <div > align='left' style='background:green;color:white;'>test2</div><BR><div > align='left' style='background:orange;color:white;'>test4</div> > > <BR> tag should be placed in between the values with same date ,date > should be printed only once. > > PLEASE ADVICE. > > Thanks in advance. > > -- > Posted via http://www.ruby-forum.com/. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---