eagle4life69 Posted March 5, 2009 Posted March 5, 2009 So I have a CSV file that I am able to read into an array, so far ok. I can search through that array and find what I am looking for but here is what I am having issues with. I may have many names for 1 address I would like to display all of the names for the 1 address. here is what my csv file looks like name,address,city,state,zip Bob Smith,1313 Harbor Blvd,Anaheim,ca,92504 Jane Smith,1313 Harbor Blvd,Anaheim,ca,92504 Lucy Doe,1313 Harbor Blvd,Anaheim,ca,92504 how can I display this info so my user can search for the name and find the address or search for the address and find the names with that address here is the code I use for what I have now $iIndex = _ArraySearch($aRecords, $sSearch, 0, 0, 0, 1) $add_array = StringSplit($aRecords[$iIndex],",") GUICtrlSetData($name,$add_array[2]) GUICtrlSetData($add1,$add_array[3]) GUICtrlSetData($city,$add_array[6]) GUICtrlSetData($state,"CA") GUICtrlSetData($zip,$add_array[7]) I can do the search but it would only find the first instance of the address
Moderators Melba23 Posted March 5, 2009 Moderators Posted March 5, 2009 eagle4life69,To get all instances of $sSearch you will have to keep looping through _ArraySearch with a new $iStart parameter (the last found index + 1) until you get @error = 6 - "$vValue was not found in array".That should get you all indices which match $sSearch. if you saved them into an array as you went along, you could then display the result (with ListView perhaps?).M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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