McGod Posted January 19, 2007 Posted January 19, 2007 Ok I got an date array and it needs to be organized. I grab the dates (20070118193735|YEARMONDAYHRMINSEC) then I need to organize them them highest at the top, but i need to have the multi dims so I can figure out which post is where. Ill explain a bit more. "Before" said: $sArray[1][0] = "20070117125235" $sArray[1][1] = "1" $sArray[2][0] = "20070118193735" $sArray[2][1] = "2" "After" said: $sArray[1][0] = "20070118193735" $sArray[1][1] = "2" $sArray[2][0] = "20070117125235" $sArray[2][1] = "1" So, Post "1" has been posted in last yesterday and Post "2" was today. That would be what it looks like AFTER Sorting. This is a huge speedbump in my forums and i just cant seem to figure it out!!! [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
Paulie Posted January 19, 2007 Posted January 19, 2007 Chip said: Ok I got an date array and it needs to be organized. I grab the dates (20070118193735|YEARMONDAYHRMINSEC) then I need to organize them them highest at the top, but i need to have the multi dims so I can figure out which post is where. Ill explain a bit more. So, Post "1" has been posted in last yesterday and Post "2" was today. That would be what it looks like AFTER Sorting. This is a huge speedbump in my forums and i just cant seem to figure it out!!! #include <Array.au3> _ArraySort()
McGod Posted January 19, 2007 Author Posted January 19, 2007 I've been trying to work with _ArraySort [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
_Kurt Posted January 19, 2007 Posted January 19, 2007 (edited) May I suggest a func similar to this: $sArray[2][0] = "20070117125235" $sArray[1][0] = "20070118193735" $trimyear1 = StringTrimRight($sArray[1][0], 10) $trimyear2 = StringTrimRight($sArray[2][0], 10) If $trimyear1 < $trimyear2 Then ;do whatever Else If $trimyear1 = $trimyear2 Then $trimmonth1 = StringTrimRight($sArray[1], 8) $trimmonth2 = StringTrimRight($sArray[2], 8) $trimmonth1 = StringTrimLeft($trimmonth1, 4) $trimmonth2 = StringTrimLeft($trimmonth2, 4) If $trimmonth1 < $trimmonth2 Then ;and so on Just an idea, I guess. it basically checks if $x's year is bigger than $y's, if the year isn't bigger and if it's equal, it checks the month.. and so on.. Hopefully I make sense, Kurt EDIT: minor fix in script Edited January 19, 2007 by _Kurt Awaiting Diablo III..
McGod Posted January 19, 2007 Author Posted January 19, 2007 (edited) It does but there can be 50 variables. Its for post by date for my Au3Forums. K what I need it to do is _ArraySort my $sArray[1][0] And move the [1] where the correlating [0] is so say it $sArray[1][0] = "9" $sArray[1][1] = "4" $sArray[2][0] = "3" $sArray[2][1] = "22" $sArray[3][0] = "1" $sArray[3][1] = "5" So I want to arrange [1][0], [2][0] and [3][0] by there number so it would be like 1, 3, 9 And have the the [1][1] [2][1] [3][1] Move accordingly. So it would look like. $sArray[1][0] = "1" $sArray[1][1] = "5" $sArray[2][0] = "3" $sArray[2][1] = "22" $sArray[2][0] = "9" $sArray[4][0] = "4" Note the 4, 22, 5 moved to where they are suppose to be. Edited January 19, 2007 by Chip [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
_Kurt Posted January 19, 2007 Posted January 19, 2007 Woops, never thought of that. Hmm, that's a toughy, perhaps arranging dates/times in a different format rather than YEARMONDAYHRMINSEC ? Or if you can't find anything, perhaps creating a function based off the example above considering that StringTrim's run relatively fast, something like Sort($sArray1,$sArray2). Or maybe writting in some sort of log, saying that $sArray will always be 2nd in the webpage, etc. Sorry buddy, can't really help you out, don't know how your WebForum thing works, and evidentely I am of no use. Kurt Awaiting Diablo III..
McGod Posted January 19, 2007 Author Posted January 19, 2007 hmm, basically what I need is a _ArraySort that shuffles the second dim. [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
McGod Posted January 19, 2007 Author Posted January 19, 2007 OMG IM SO HAPPY, I added 4 words to the end of my sql query and it SORTS IT FOR ME OMG IM SO HAPPY!!!! ORDER BY LastPostDate DESC [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now