JavaScript - Sorting An Array By Date Desc
Hi All.
I have a dynamic Coldfusion form which adds multiple addresses which holds fields like Town, Postcode, ResidentFromDate, ResidentToDate... and on click of the save button I have a script function that runs which I am trying add all the elements of this form into an array and then sort by ResidentFromDate and output the results... Here is what I have at the minute but my sort does not seem to be working and is throwing out results in the following order (10/2006, 01/2005, 08/2006, 01/2007) and that is clearing not in descending order... If someone could take a look at my script and tell me what is wrong I would be much appreciated (see below) * I seem to be getting results and it is just not sorting correctly, so my theory is something is up with the part where I am calling addresses.sort. Code: var dates = { convert:function(d) { // Converts the date in d to a date-object. The input can be: // a date object: returned without modification // an array : Interpreted as [year,month,day]. NOTE: month is 0-11. // a number : Interpreted as number of milliseconds // since 1 Jan 1970 (a timestamp) // a string : Any format supported by the javascript engine, like // "YYYY/MM/DD", "MM/DD/YYYY", "Jan 31 2009" etc. // an object : Interpreted as an object with year, month and date // attributes. **NOTE** month is 0-11. return ( d.constructor === Date ? d : d.constructor === Array ? new Date(d[0],d[1],d[2]) : d.constructor === Number ? new Date(d) : d.constructor === String ? new Date(d) : typeof d === "object" ? new Date(d.year,d.month,d.date) : NaN ); }, compa function(a,b) { // Compare two dates (could be of any type supported by the convert // function above) and returns: // -1 : if a < b // 0 : if a = b // 1 : if a > b // NaN : if a or b is an illegal date // NOTE: The code inside isFinite does an assignment (=). return ( isFinite(a=this.convert(a).valueOf()) && isFinite(b=this.convert(b).valueOf()) ? (a>b)-(a<b) : NaN ); }, inRange:function(d,start,end) { // Checks if date in d is between dates in start and end. // Returns a boolean or NaN: // true : if d is between start and end (inclusive) // false : if d is before start or after end // NaN : if one or more of the dates is illegal. // NOTE: The code inside isFinite does an assignment (=). return ( isFinite(d=this.convert(d).valueOf()) && isFinite(start=this.convert(start).valueOf()) && isFinite(end=this.convert(end).valueOf()) ? start <= d && d <= end : NaN ); } } // define array var addresses = []; // if atAddrSince is greater than 5 years from today if (atAddrSince > addrFromValidate) { // loop round each previous address for (i=1;i<=maxID;i++) { var addrPart = []; if (eval('document.fmAddPrevAddr.address1'+i)) { var address1 = eval('document.fmAddPrevAddr.address1'+i+'.value'); var town = eval('document.fmAddPrevAddr.town'+i+'.value'); var country = eval('document.fmAddPrevAddr.country'+i+'.value'); var postcode = eval('document.fmAddPrevAddr.postcode'+i+'.value'); var residentfrom = eval('document.fmAddPrevAddr.ataddrsince'+i+'.value'); var residentto = eval('document.fmAddPrevAddr.ataddrto'+i+'.value'); // insert into array addrPart[0]=address1; addrPart[1]=town; addrPart[2]=country; addrPart[3]=postcode; addrPart[4]=residentfromdate; addrPart[5]=residenttodate; addresses.push(addrPart); } } addresses.sort(sortfunction) function sortfunction(a, b) { if(dates.compare(a[4],b[4]) == -1) { return true; } else { return false; } } for (var v=0;v<addresses.length;v++) { var addresses1 = addresses[v]; alert(addresses1[4]); } } Many Thanks, George Similar TutorialsHi All, I've done a few searches on it, but I can't seem to find the correct order for my date / time script. I have a field that returns the date/time in the following format: Y-m-d H:i:s (i.e. yyyy-mm-dd hh:mm:ss) What I want to do is rearrange this so that it says: 'dd' 'month-name' 'yyyy' at 'time' Anyone have any ideas? Thanks, Neil I am trying to use JavaScript in conjuntion with html to display a table of sortable cities, states and dates. The dates are my problem. I am a novice and was given this code. But it seems to sort in European style, yyyy/mm/dd. I need it to sort mm/dd/yyy, which i am told is US style. Any help on this, I would be most grateful for. I have placed a page here to let you see the code at work. This page has the code on it in text also. I do not mind posting the code hgere also if you prefer. Thanks for any help you may be willing to offer me with this. Preston I am trying to sort an array of strings based on the location of a string called "this.oText.value" inside an array of strings called "aList." If "this.oText.value" comes earlier in an entry in aList (call it "a") than another entry "b", I want "a" to appear before "b". Clearly, there is something very wrong with my code. It really isn't doing anything as of right now. Code: aList.sort(sortArray); function sortArray(a,b) { if(a.toLowerCase().indexOf(this.oText.value.toLowerCase()) < b.toLowerCase().indexOf(this.oText.value.toLowerCase())) return 1; else if(a.toLowerCase().indexOf(this.oText.value.toLowerCase()) > b.toLowerCase().indexOf(this.oText.value.toLowerCase())) return -1; else return 0; } So, I'm using code like the following and getting errors: result = a list of cars with each property separated by ',' and each car separated by '|' This code creates and populates the array (seems to work) Code: var carList = new Array(); var cars = new Array(); var properties = new Array(); cars = result.split("|"); for(var i=0; i<cars.length;i++){ properties = cars[i].split(","); carlist[carlist.length++] = new car(items[0],items[1],items[2]); function car(id,make,model){ carID = id; carMake = make; carModel = model; } Later, I want to sort the array and call it like this: carList.sort(carSort); here's the sort code Code: function carSort(a, b){ var x = a.carMake.toLowerCase(); var y = b.carMake.toLowerCase(); return ((x < y) ? -1 : ((x > y) ? 1 : 0)); } I get the error that "a.carMake does not exist" (in firebug). What am I doing wrong? I am trying to make an addition to a .js plugin for a wiki. Currently it does not support sorting my IP address. So far I have created the below code which does more than the script initially did, but is still not sorting 100% correctly. Any tips? Code: sort_ipaddr: function(a,b){ aa = a[0].split(".",4); bb = b[0].split(".",4); var counti = 0; for (var i=0; i<4; i++) { if (parseInt(parseFloat(aa[i])) == parseInt(parseFloat(bb[i]))){} if (parseInt(parseFloat(aa[i])) < parseInt(parseFloat(bb[i]))){counti--} if (parseInt(parseFloat(aa[i])) > parseInt(parseFloat(bb[i]))){counti++} } return counti; }, EDIT I've also tried this which is closer but still not there. Code: sort_ipaddr: function(a,b){ aa = a[0].split(".",4); bb = b[0].split(".",4); var resulta = (aa[3]+(aa[2]*256)+(aa[1]*256*256)+(aa[0]*256*256*256)); var resultb = (bb[3]+(bb[2]*256)+(bb[1]*256*256)+(bb[0]*256*256*256)); return resulta-resultb; }, This results in a list like so: 10.1.15.22 10.1.16.22 10.1.15.23 10.1.15.24 10.1.16.24 10.1.15.25 What I need help with is sorting the [0] of my array. I need it to sort so that if the user puts in his last name, whether its uppercase or lowercase (Adams, adams), it will sort through the list of students I add, and put them in an alphabetic order i.e adams, Adams, cook, Douglas....and so on. Here is the code that I have below for just sorting by last name, which will seperate the lowercase entries from the uppercase entries. That would be the opposite of what I want. I had it sorted so that it would sort the [o], which is where the last name value is located. Any thoughtful help would be appreciated. Code: function Last_names( s1, s2 ) { if ( s1[0] > s2[0] ) return 1; return 0; } function sortLast(form) { StudentsLists.sort( Last_names ); windows(form);//calling the windows function each time the sortLast function is called } Code: var myarray2=[25, 8, 7, 41]; myarray2.sort(function(a,b){return a - b}) I have tried this code and it works. What I don't understand is, how does array understand which value should be taken as "a" and "b" ? How does javascript understand what is to be done with values, if it is not specified by coding logic ? Is there some kind of in-built functionality ? How is that functionality triggered ? Do I not require further coding as Code: for(i=0; i<myarray2.length; i++){ j=i+1; for((myarray2[i]-myarray2[j])>0){ var a = myarray2[i]; myarray2[i] = myarray2[i+1]; myarray2[i+1] = a; j=j+1;} } and then run two loops for two comparing two values ? Thanks Hi everyone I'm having a hard time, wrapping my head around an array sort+combine function. I have an array which would look somewhat (these are simplified numbers) like this Code: TestArray = [ ["222222","1"], ["222222","1"], ["222222","1"], ["333333","1"] ["111111","1"], ["000000","2"], ["111111","2"], ["111111","2"], ["222222","20"], ]; I got it as far as to be sorted like this: Code: SortedArray = [ ["000000","2"], ["111111","1"], ["111111","2"], ["111111","2"], ["222222","1"], ["222222","1"], ["222222","20"], ["222222","1"], ["333333","1"] ]; And from there to this: Code: BadlyMergedArray = [ ["000000","2"], ["111111,"1","2"], ["222222","1","20","1"], ["333333","1"] ]; But I want to end up with this: Code: MergedArray = [ ["000000","2"], ["111111","1","2"], ["222222","1","20"], ["333333","1"] ]; So the first part of the inner arrays is the first item to be sorted and combined by. After that, the smaller numbers have to do practically the same, while staying in the correct order under the first sort. I'm only a spare time programmer, and my code is probably one of the most confusing pieces of code ever written. I am assuming that this is some fairly easy stuff for one of you guys. I can post my code, but I think there's a much easier solution to it, so I wanted to see if someone can point me in the right direction, or show me how this is properly done. Thanks so much! here's to hoping! patrick/shootingpandas Hi, I have written this program: Code: var scores=[]; function sortScores(scoreRecs){ for(i=0;i<scoreRecs.length;i++) scores.push(scoreRecs[i]); for(var i=0;i<scores.length;i++) { for(var j=i+1;j<scores.length;j++) { if(Number(scores[i])>Number(scores[j])) { tempValue=scores[j]; scores[j]=scores[i]; scores[i]=tempValue; } } } alert(scores); } sortScores(["5","6","5","7","7"]); to take an array of variables in calling the function (ie sortScores), place these variables into an empty array("scores"), apply the bubble sort to scores, and then alert scores in sorted form. When I use test values like I have above, where they are all just numbers, this program works perfectly and alerts the "scores" array, correctly sorted. However, what I would like to do is to call the function with an array of records, each containing two fields, and apply the same sort to the array of records, based on the value in the first field of each record.To illustrate, i'd like to be able to call the function thus: Code: sortScores([{sco 0,index:0},{sco 2, index:1},{sco 1,index:2}]); and for it to sort the records in descending order of the value of the "score" field. So the above call would alert: Code: [{sco 2,index:1},{sco 1,index:2},{sco 0,index:0}] however, i'm not sure how i'd reference the numeric part of the f1 of each record in the sort? Hopefully you can see what I'm trying to achieve...any ideas would be greatly appreciated. Code: <html> <head> <title>Birthday Array</title> </head> <body> <script language="javascript" type="text/javascript"> var date = [10] new date[0](98,3,22), new date[1](98,2,22), new date[2](94,3,29), new date[3](92,3,2), new date[4](89,2,1), new date[5](98,6,22), new date[6](97,5,22), new date[7](99,12,31), new date[8](80,3,3), new date[9](88,7,7); for(var i=0;i<date.length;i++) { if (date = (Today)) { document.write("Happy Birthday") } else { document.write(date[i]+ "<br>"); } } </script> </body> </html> Its supposed to display 10 birthdays on seperate lines and it is supposed to display happy birthday next to dates in March. I've been trying to change the way a date appears. The JS gives the date Easter will fall in a particular year. That works but the format that appears is this; Sun Apr 24 00:00:00 EDT 2011 I'm trying to get it to read like this: Sunday, April 24, 2011 I've been racking my brain all morning and can't seem to get it right. Very limited experience in JS doesn't help either. Could somebody take a look and see where I messed up. Thanks in advance. George Code: easterYear = 2011; var a, b, c, d, e, f, g, h, i, k, l, m, easterMonth, easterDate; a = parseInt(easterYear % 19); b = parseInt(easterYear / 100); c = parseInt(easterYear % 100); d = parseInt(b / 4); e = parseInt(b % 4); f = parseInt((b + 8) / 25); g = parseInt((b - f + 1) / 3); h = parseInt((19 * a + b - d - g + 15) % 30); i = parseInt(c / 4); k = parseInt(c % 4); l = parseInt((32 + 2 * e + 2 * i - h - k) % 7); m = parseInt((a + 11 * h + 22 * l) / 451); easterMonth = parseInt((h + l - 7 * m + 114) / 31); easterDate = parseInt(((h + l - 7 * m + 114) % 31) + 1); var dayName = new Array ("Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"); var monthName=new Array ("January","February","March","April","May", "June","July","August","September","October", "November","December"); var now = new Date(); var gplMonth = monthName[easterMonth-1]; var gplDay = dayName[0]; //gplDay ; var gplDate = new Date(); var gplDt = gplDate.getDate(); document.write(new Date(easterYear , easterMonth - 1, easterDate) ); // Original line document.write('<br />' ) document.write( gplDay + ", " + gplMonth + " " + easterDate + ", " + easterYear) document.write('<br />' ) document.write(gplMonth + " " + easterDate ) document.write('<br />' ) Not sure if this is possible in javascript: I'm looking for two different dates (bill date and due date) on an invoice that are captured by OCR. If one of them exists, but the other does not, I want the empty field to be 14 days before (or after) the other. For example: if the bill date is 7/27/2010 and the due date was not captured, I want to set the due date as 8/10/2010 (14 days after the bill date). If the due date was captured as 8/10/2010, but the due date is blank, I want to assign the bill date as 7/27/2010 (14 days before the due date). if both dates have values, do nothing. Thanks. Using Adobe Form Javascript validation, how would I do this code for Visual Basic in Javascript (non web) Code: If PurchaseDate.Value > Date Then MsgBox ("PurchaseDate cannot be greater than Today's Date!") Cancel = True End If Something along these lines but this isnt working: Code: If (PurchaseDate.Value > Date) Then { app.alert ("Purchase Date cannot be greater than Today's Date!"); } Thanks I have a drop down menu where people can select a month, day and year. Based on their selection, I want to show them an image. If their selection is >= July 26, 2010 but <= July 25, 2011, show the red image; If their selection is >= July 26, 2011 but <= July 25, 2012, show the white image; If their selection is >= July 26, 2012 but <= July 25, 2013, show the blue image; If their selection is >= July 26, 2013 but <= July 25, 2014, show the yellow image; I don't know how to compare a selected date to a range of dates like this. Hi, I need to add days to a date in javascript, My requirement is as follows: Date is coming from a textbox. eg:- 26/07/2010 days from this statement var day1=document.getElementById('<%=HiddenDate.ClientID %>').value; an eg:- if the date is 28/01/2012 and days Needed to be added=5 the added date should be 02/02/2012. Can anybody help me? Thanks Jamuna Hello, I really need your help with one. How can I use the following code below to save the date from my popup window datepicker back into a var and relay it back onto its parent page? I can't seem to figure this out: Code: <html> <head> <script> function open_cal() { var str_html = "" + "<!DOCTYPE html>\n" + "<html lang=\"en\">\n" + "<head>\n" + "<meta charset=\"utf-8\">\n" + "<title>CALENDAR</title>\n" + "<link href=\"jq/jquery-ui.css\" rel=\"stylesheet\" type=\"text/css\">\n" + "<script src=\"jq/jquery.min.js\" type=\"text/javascript\"></" + "script>\n" + "<script src=\"jq/jquery-ui.min.js\" type=\"text/javascript\"></" + "script>\n" + "<script src=\"jq/datepicker.js\" type=\"text/javascript\"></" + "script>\n" + "</head>\n" + "<body>\n" + "<div id=\"text\" style=\"font: bold 10pt Tahoma\">Enter Approval Date:</div>\n" + "<div id=\"datepicker\"></div>\n" + "</body>\n" + "</html>" var j = window.open("","CALENDAR","width=200,height=250,status=no,resizable=yes,top=200,left=200") j.opener = self; j.document.write(str_html); } </script> </head> <body> <input onclick="open_cal()" type="button" value="Open" name="B1"> </body> </html> Datepicker.js: Code: $(function() { $( "#datepicker" ).datepicker({ dateFormat: 'dd/mm/yy', onSelect: function(dateText, inst) { alert(dateText) window.close() } }) }); Any help with this is greatly and mostly appreciated. Thanks in advance, Cheers, J Hi, I've inherited a Form which calculates a future date based on a calculation and then inserts today's date and the future date into a database. The day part of the date is formatted as a number. This is fine, but up to 9 the numbers display in single figures with no leading zeros. I want them to display leading zeros (e.g. 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11... 30, 31) So; 1/12/2010 is NOT wanted 01/12/2010 IS wanted The inherited code originally set the Month names as "Jan", "Feb" etc, and it was easy to kludge these to 01, 02... 12, but I suspect there's a more elgant solution to this as well, this bit of the code works so it's not as vital to neaten this but my database needs dd/mm/yyyy format (it's a third party email program). Code: </script> <script type="text/javascript"> var todaysDate = new Date(); function updateExpiryDate(){ var weeklyMileage = document.getElementById('AvWeeklyMileage').value; var expiryDate; var weeks = 0; var expiryDateString = ''; if (!isNaN(parseInt(weeklyMileage))){ weeks = 700/weeklyMileage; expiryDate = new Date(todaysDate.getTime() + (1000 * 3600 * 24 * 7 * weeks)); var expiryDateString = expiryDate.getDate() + '/' + getMonthString(expiryDate.getMonth()+1) + '/' + expiryDate.getFullYear(); document.getElementById('expiryDate').innerHTML = expiryDateString; document.getElementById('ShoeExpiryDate').value = expiryDateString; } else { document.getElementById('ShoeExpiryDate').value = ''; document.getElementById('expiryDate').innerHTML = 'Please enter a valid weekly average mileage' } } function getMonthString(monthNumber){ var monthString = ""; switch(monthNumber){ case 1: monthString = "01"; break; case 2: monthString = "02"; break; case 3: monthString = "03"; break; case 4: monthString = "04"; break; case 5: monthString = "05"; break; case 6: monthString = "06"; break; case 7: monthString = "07"; break; case 8: monthString = "08"; break; case 9: monthString = "09"; break; case 10: monthString = "10"; break; case 11: monthString = "11"; break; case 12: monthString = "12"; break; default: // do nothing; } return monthString; } function setTodaysDate(){ var todaysDateString = todaysDate.getDate() + '/' + getMonthString(todaysDate.getMonth()+1) + '/' + todaysDate.getFullYear(); document.getElementById('todaysDate').innerHTML =todaysDateString; document.getElementById('DateOfPurchase').value = todaysDateString; } Can someone point me in the right direction please? Hi everyone, I'm new to the forums. I have been coding some simple javascript but it is really new to me. I coded a segment that you can see below but the part in bold doesn't work. I need it to sort by count descending. I'm having major issues with it. Thanks for the help ahead of time Code: <html> <head> <title>ENGO Lab 2.1</title> <script type="text/javascript"> var d=new Date(); var weekday=new Array(7); weekday[0]="Sunday"; weekday[1]="Monday"; weekday[2]="Tuesday"; weekday[3]="Wednesday"; weekday[4]="Thursday"; weekday[5]="Friday"; weekday[6]="Saturday"; var month=new Array(12); month[0]="January"; month[1]="February"; month[2]="March"; month[3]="April"; month[4]="May"; month[5]="June"; month[6]="July"; month[7]="August"; month[8]="September"; month[9]="October"; month[10]="November"; month[11]="December"; document.write("Today is " + weekday[d.getDay()] + "<br />" + d.getFullYear() + "/" + month[d.getMonth()] + "/" + d.getDate() + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds()); </script> <script type="text/javascript"> function sort_descending_count(w){ var sorted = w.sort(); sorted.reverse(); var stuff; var wordCounts = {}; var wordHold = {}; for(i=0; i < w.length; i ++ ){ stuff = sorted[i]; if( wordCounts[stuff] == null ){ wordCounts[stuff] = 1; wordHold[stuff] = stuff; } else{ wordCounts[stuff] += 1; } } var i = 1; wordCounts.sort(); var i = 1; var str = '<table border="1" cellspacing="1" cellpadding="5"><th>Sequence</th><th>Word</th><th>Count</th>'; for( stuff in wordCounts){ str+='<tr><td>'+i+'</td><td>'+stuff+'</td><td>'+wordCounts[stuff]+'</td></tr>'; i = i+1; } str+='</table>'; document.getElementById('change2').innerHTML = txt; } </script> <script type="text/javascript"> function sort_descending(w){ var sorted = w.sort(); sorted.reverse(); var stuff; var wordCounts = {}; for(i=0; i < w.length; i ++ ){ stuff = sorted[i]; if( wordCounts[stuff] == null ){ wordCounts[stuff] = 1; } else{ wordCounts[stuff] += 1; } } var i = 1; var str = '<table border="1" cellspacing="1" cellpadding="5"><th>Sequence</th><th>Word</th><th>Count</th>'; for( stuff in wordCounts){ str+='<tr><td>'+i+'</td><td>'+stuff+'</td><td>'+wordCounts[stuff]+'</td></tr>'; i = i+1; } str+='</table>'; document.getElementById('change2').innerHTML = str; } </script> <script type="text/javascript"> var words; function show_prompt() { var name=prompt("Please input a list of words seperated by a space","Banana Apple Orange"); if (name!=null && name!="") { // split input into array using space var arrayOfWords = name.split(" "); // construct object to save each word and its count var wordCounts = {}; words = arrayOfWords; for(i=0; i < arrayOfWords.length; i ++ ){ var w = arrayOfWords[i]; if( wordCounts[w] == null ){ wordCounts[w] = 1; } else{ wordCounts[w] += 1; } } // output the result var str = '<table border="1" cellspacing="1" cellpadding="5"><th>Word</th><th>Count</th>'; for( w in wordCounts){ str+='<tr><td>'+w+'</td><td>'+wordCounts[w]+'</td></tr>'; } str+='</table>'; document.getElementById('change').innerHTML = str; var button = '<input type="button" onclick="sort_descending(words)" value="Sort with word alphabetically descending">'; var button2 = '<input type="button" onclick="sort_descending_count(words)" value="Sort with word count descending">'; document.getElementById('sorting').innerHTML = button; document.getElementById('sorting2').innerHTML = button2; } else { alert("The Input is Not Valid"); } } window.onload=show_prompt; </script> </head> <body> <br /> <div id="change"> </div> <div id="sorting"> </div> <div id="sorting2"> </div> <div id="change2"> </div> </body> </html>] Good evening all, I have a form at work that was created to allow for clients information to be inputted into this form. However when the row is inserted it is sorted oldest to newest. I would like to change this however i'm not really sure were to start. Below I have added the javascript code that refers to the addrow function. Any advice would be helpful. Code: function addRow(id){ var tbody = document.getElementById(id).getElementsByTagName("TBODY")[0]; var row = document.createElement("TR") var td1 = document.createElement("TD") textArea = document.createElement('TEXTAREA') td1.appendChild(document.createElement("textarea")) var td2 = document.createElement("TD") textArea = document.createElement('TEXTAREA') td2.appendChild(document.createElement("textarea")) var td3 = document.createElement("TD") textArea = document.createElement('TEXTAREA') td3.appendChild(document.createElement("textarea")) var td4 = document.createElement("TD") textArea = document.createElement('TEXTAREA') td4.appendChild(document.createElement("textarea")) var td5 = document.createElement("TD") textArea = document.createElement('TEXTAREA') td5.appendChild(document.createElement("textarea")) var td6 = document.createElement("TD") textArea = document.createElement('TEXTAREA') td6.appendChild(document.createElement("textarea")) row.appendChild(td1); row.appendChild(td2); row.appendChild(td3); row.appendChild(td4); row.appendChild(td5); row.appendChild(td6); tbody.appendChild(row); var tbody = document.getElementById(id).getElementsByTagName("TBODY")[0]; var row = document.createElement("TR") var td1 = document.createElement("TD") td1.appendChild(document.createTextNode("Remarks:")) var td2 = document.createElement("TD") textArea = document.createElement('TEXTAREA') td2.colSpan="4"; td2.appendChild(document.createElement("textarea")) row.appendChild(td1); row.appendChild(td2); tbody.appendChild(row); } Hi, I would like to sort a table which has inner table using Javascript. When I try to sort, both the outer table and the Inner table are getting sorted. For Eg: I have a table like this: Category1 10.20.30.40 Issue1 sample1 sample2 sample3 Code1 xyz abc The outer table contains Category1,Issue1,Code1 So, after sorting my table should look like this: Category1 10.20.30.40 Code1 xyz abc Issue1 sample1 sample2 sample3 Please provide a solution for this. |