Duff360

Search in Array and Copy the Data

7 posts in this topic

#1 ·  Posted (edited)

Hello,

I will try to be as clear as possible :)

I'm using _IETableGetCollection to get a table from IE to an Array.

I would like to know how to search a word in the array and copy the data in the same row.

Please see the uploaded image. In this array, I would like to search for the word "Australian dollar" and copy the data in the column 4 (1.0121) to my clipboard. And I would like to do it for a coupe of country. For each country I only want the data in the column 4.

Thanks you in advance,

Félix

 

Array.jpg

Edited by Duff360

Share this post


Link to post
Share on other sites



#2 ·  Posted

Have a look in the help file for _ArraySearch

Share this post


Link to post
Share on other sites

#3 ·  Posted

I already did, but I still don't know how to do it.

I'm not really good with AutoIT...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@Duff360 what exactly is confusing you? You already have the code to pull the data from IE, per your first post (it would help if you posted your code, rather than asking us to guess). And _ArraySearch has a 2 very simple examples, so what exactly is not working for you?

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted

I'm able to find the expression "Australian dollar", but how can I copy the data from column 4?
It's probably easy, but I really don't know!

Local $sSearch = "Australian dollar"
Local $sColumn = "0"
$sColumn = Int($sColumn)
Local $iIndex = _ArraySearch($aTableData, $sSearch, 0, 0, 0, 1, 1, $sColumn)
If @error Then
    MsgBox($MB_SYSTEMMODAL, "Not Found", '"' & $sSearch & '" was not found on column ' & $sColumn & '.')
Else
    MsgBox($MB_SYSTEMMODAL, "Found", '"' & $sSearch & '" was found in the array at position ' & $iIndex & ' on column ' & $sColumn & '.')
EndIf

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

small example

#include <Array.au3>

Local $as_Array[2][5] = _
        [['Currency', '2017-01', '2017-02', '2017-03', '2017-04'], _
        ['Australian dollar', '0.9854', '1.0045', '1.0204', '1.0121']]

Local $i_Index = _ArraySearch($as_Array, 'Australian dollar')

If Not @error Then
    MsgBox(0, '', $as_Array[$i_Index][4])
    ClipPut($as_Array[$i_Index][4])
Else
    MsgBox(0,'Not found', 'Search string not found')
EndIf

 

Edited by benners
typo

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