mithandir1

Need help with _arraySearch

3 posts in this topic

#1 ·  Posted

I have a simple CSV file with 2 columns.  I want to search for the value in the first column and return the value in the second.  I have experimented with _arraysearch and can get it to retrun the correct row, but I can figure out how to get the value of the second column.  I am sure this very simple, any help would be appreciated. Here is the code I have been playing with:

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
$tag = 1234

Local $aRetArray, $sFilePath = @ScriptDir & "\index.csv"
  _FileReadToArray($sFilePath, $aRetArray,"",",")
  _ArrayDisplay($aRetArray, "", Default, 8)
 $row = _ArraySearch($aRetArray, $tag,"","","","", 1)
 MsgBox(0,"This finds the row", $row)

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

So to return the second column value you would use $aRetArray[$row][1] 

Edited by Subz
1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted

Just now, Subz said:

So to return the second column value you would use $aRetArray[$row][1] 

Thank you very much.  I knew it had to simple.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now