How to get the column value based on the specified value matched in the table

Hi,

I have a 2 string variable value, please find the screenshot table, I need to get the Amount column value ,Once found those 2 variable value in the table
image

e.g. StrVariable1 = “GHL /SDF”
StrVariable2 = “bb”

I need to find StrVariable1 in the table, once that value matched, Need to find the
StrVariable2 in that table. Once StrVariable2 value has been matched i need to take the value from Amount column (i.e) 30

likewise in the next loop, i will be having the 2 variable value & Again i need to get amount column value once matched with other 2 variable value.

Can someone guide me on this . Thanks!!

Hi,

An approach would be to save somewhere the strings that you are looking for, preferably in a dictionary where the key would be String1 and the value String 2 (e.g. {“GHL/SDF”,“bb”}).

Now you can iterate through the dictionary items and have something like this:

For each Dictionary item:
elementFound = false
    For each row in table:
        if (CurrentRow("Name")=CurrentKey)
            save current row index
            elementFound = true
            break
    if (elementFound = true)
        For each row in table: //the search will start from last index found so we skip redundant iterations
            if(currentRow("Name") = Dictionary(Key))
                get the value from column amount
                //do whatever else you want
                break

Let me know if you need more clarification on this!

Hi @jamuna_T

You can try this way

  1. Assign the input string and read the excel file

image

  1. Then use the lookup data table activity

Here Mention the lookup column name ,Create the output of RowIndex , pass the Dt and Lookup value

  1. Use the If condition RowindexLookup.Equals(-1) if the string is not present in the Dt it will go to Then part. If its present it will go to Else part

image

  1. In Else part again use the lookup data table activity
    Mention all required fields and create the output of cellvalue and Mention the Target column 2 means it is Amount column value it will give

Note: cellvalue output variable type is System.object

  1. Again use the same if condition above mention as , if the string2 is present it will go else or else it will go to true.

Else part you can get the Amount column value

image
image

Regards,
Gowtham K

Hi @Gowtham_K115
Can you please provide this xaml.

@jamuna_T

Kindly find the Xaml

Testing.xaml (17.2 KB)

Hi @jamuna_T

Can you try the below

Sequence21.xaml (22.1 KB)

Regards,