Multidimensional (2) array contains value in first dimensional get value from second dimensional

studio

#1

I am suppose to check some numbers from a website against an Excel file. It is not allways the same number of fields, but I know the length so I am able to create the array. I am scraping data from the website 2 times, first time the headers and second time the result numbers (into 2 different datatables). Afterwards I create the multidimensional (2 columns) array with the data from the 2 datatables. Now I want to check if a header text exist in the array (first column) and then get the result (second column) but I can’t figure out the syntax (see failing if statment)!

Can anybody tell me the syntax?

Example.xaml (14.3 KB)


#2

@Claus
I think you can use Dictionary here.

Regards,
Mahesh


#3

Hi Mahesh1,

thank you for your answer, and you might be right but I can’t find that much about the use of Dictionary, and in video 3.4 Data Manipulation they mention it is when extracting data from Orchestrator queues. I was thinking I could create my own dataTable instead of the array and then use .select(where clause) but for now I’ll wait and see if there is anybody who can help my like it is.

BR
Claus


#4

@Claus
One column contain headers and other contain Values right and the headers are unique right

Regards,
Mahesh


#5

Yes like this (headers are unique):

Headers, Total amounts
Feltnr 0013, 89.024.369,08
Feltnr 0014, 5.943,00
Feltnr 0015, 33.392.051,00


#6

@Claus
Merge Two Columns into a Single DataTable dta
Dictionaryabc= (From p In dta.Select
Select p).ToDictionary(Function(x) x(“Headers”).ToString, Function(x) x(“Total”).ToString)

Now you can acess the amount based on Key that is headers.
I have not tested the code. sorry if it throws any exception

Regards,
Mahesh


#7

I will test it tomorrow. Thanks.


#8

@Claus
Sure

Regards,
Mahesh


#9

I have changed it from multidimensional array into a datatable instead and then I am using:
.Select(string.Format(“Header = ‘{0}’”, “0056”))

@MAHESH1 thanks for your help.

The new version is here for download if anyone is interested:
Example.xaml (17.3 KB)