wisem2540 Posted June 30, 2014 Posted June 30, 2014 Hello all, Looking for a little direction here to get started... I will return the main array of say... 1000 computers Then create a GUI with dropdown lists First dropdown list would be building. Building1 Building2 Building3 The bulding name would be included in the computer name. Then I would have a second dropdown with which Floor of the building they were on. As I select these, I would like to see the list filter down. So my question is really would I use _ArrayFindAll for this mostly, then loop through and create data for the dropdowns? Or is there an easier way?
jdelaney Posted June 30, 2014 Posted June 30, 2014 (edited) You could create arrays for each building+floor combo. Then no filter would be needed at all. Such as in an array of arrays. #include <Array.au3> $iBuildingCount = 5 $iFloorCountPerBuilding = 3 $iSomeOtherDataCount = 10 Global Enum $iBuilding, $iFloor, $iOther, $iUbound Global $aaBuildings[$iBuildingCount*$iFloorCountPerBuilding][$iUbound] $iCounter = 0 For $j = 0 To $iBuildingCount-1 For $k = 0 To $iFloorCountPerBuilding-1 $aaBuildings[$iCounter][$iBuilding]="Building" & $j+1 $aaBuildings[$iCounter][$iFloor]="Floor" & $k Global $otherdata[$iSomeOtherDataCount] $aaBuildings[$iCounter][$iOther]=$otherdata $iCounter+=1 Next Next _ArrayDisplay($aaBuildings) [0]|Building1|Floor0| [1]|Building1|Floor1| [2]|Building1|Floor2| [3]|Building2|Floor0| [4]|Building2|Floor1| [5]|Building2|Floor2| [6]|Building3|Floor0| [7]|Building3|Floor1| [8]|Building3|Floor2| [9]|Building4|Floor0| [10]|Building4|Floor1| [11]|Building4|Floor2| [12]|Building5|Floor0| [13]|Building5|Floor1| [14]|Building5|Floor2| The 3rd subscript of each record is the array of data. Edited June 30, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
wisem2540 Posted June 30, 2014 Author Posted June 30, 2014 That is a fine idea, But I would still have to populate them somehow based on some type of criteria, but you are saying that would be the only "Filter" then correct? Does it make sense to maintain a large array, or "Array of Arrays?" Or would I be better off maintaining seperate arrays for each combination?
jdelaney Posted June 30, 2014 Posted June 30, 2014 (edited) Performance is supposed to degrade if the array of arrays is too large. But if you only have 1000, i doubt it will matter. I threw them all into an array, so it's easier to loop through, and grab data. If you use multiple arrays, you would still need to have some sort of naming convention to cycle through them, and grab your data. (which is possible, but not as easy as a simple loop). Global $aBuilding1Floor1[$iSomeOtherDataCount] Global $aBuilding1Floor2[$iSomeOtherDataCount] Global $aBuilding2Floor1[$iSomeOtherDataCount] Global $aBuilding2Floor2[$iSomeOtherDataCount] $iBuildingCount = 1 While True $iFloorCount = 1 If Not IsArray(Eval("aBuilding" & $iBuildingCount & "Floor" & $iFloorCount)) Then ExitLoop EndIf While True If Not IsArray(Eval("aBuilding" & $iBuildingCount & "Floor" & $iFloorCount)) Then ExitLoop EndIf ConsoleWrite("aBuilding" & $iBuildingCount & "Floor" & $iFloorCount & " is valid" & @CRLF) $iFloorCount += 1 WEnd $iBuildingcount +=1 WEnd Edited June 30, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
wisem2540 Posted June 30, 2014 Author Posted June 30, 2014 (edited) jdelaney, Thanks for your help. How would I populate the array? Say I had a PC that was named ComputerMain2FLJane Main is the building 2FL is the floor Would I just use If StringinStr = 2FL then _ARRAYADD to $FLOOR2? Edited June 30, 2014 by wisem2540
Oscis Posted June 30, 2014 Posted June 30, 2014 Where are you getting your data from before it enters the program? Are you going to type the info for all 1,000 computers yourself?
jchd Posted June 30, 2014 Posted June 30, 2014 SQLite could certainly be put to some use here. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
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