Get value of second column based on found value in first column from filtered datatable

Hello,

I have 2 data tables:

  • dt1 contains a list of questions (1 question per row)
  • dt2 (2 columns) contains a very large list of questions (again, 1 question per row)

dt2’s first column is the Questions column, the second column is the Question Variable column (each variable is correlated to the question from column 1)

I’m using a Filter DataTable like so:

  • for each question in dt1, Filter DataTable dt2 where question in dt1 = question in dt2
  • if found, log found question and the correlated Question Variable

Log activity: "Question found: " + CurrentQuestion(1).ToString + " | " + "Question variable: " + dt_BruttoQuestionnaireQuestionsAndVariables_DA.Columns(1).ToString

The problem is that I couldn’t find a way to also get the Question Variable that is correlated to the found question from dt2, dt_BruttoQuestionnaireQuestionsAndVariables_DA.Columns(1).ToString always returns the name of the column, not the value that I need.

Would anyone be able to help me with this?

Thank you.

Hi @Dragos_Nae ,

I believe you would need to use the dt_QuestionFoundInTable variable to get the question value from it, as it is resultant of the Filter Datatable activity.

Maybe you would require to access it in the below way :

dt_QuestionFoundInTable.Rows(0)(1).ToString

Worked like a charm, thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.