How to get specific value from clolumn of extractdatatable

Hello,

here i am extracting data using table extraction activity and saving to variable Extractdatatable.
my requirement is to check group “Jira-software–users” exist or not in column Group name.

if exist then say yes else say no. here it exists.

how can i achieve that.
help me on same.

@Mathkar_kunal

Please try this condition in IF activity

ExtractDataTable.AsEnumerable().Any(Function(row) row(“Group name”).ToString.Trim.Equals(“jira-software-users”, StringComparison.OrdinalIgnoreCase))

Hello @Mathkar_kunal

If you are iterating the extracted data afterwards you could use:

  • For Each Row in Data Table
If CurrentRow("Group name").ToString.Contains("jira-software-users")

Regards
Soren

1 Like

if your only requirement is to check that extracted data table contains “Jira-software–users”
Then use output data table activity to convert your extracted data table into String format.
And then simply use the if condition
StringExtracteddatatable.contains(“Jira-software–users”)

This will give you yes or no

Or let me know if your requirement is something different.

1 Like

Hi @Mathkar_kunal

You can try this:

Extractdatatable - Datatable name
groupExists - Boolean variable

groupExists = Extractdatatable.AsEnumerable().
Any(Function(r)
r(“Group name”).ToString().
Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries).
Any(Function(g) g.Trim().Equals(“jira-software-users”, StringComparison.OrdinalIgnoreCase))
End Function)

Then add an If activity with the condition set to groupExists, in the Then branch write Yes and in the Else branch write No.

instaead direcryly using in if i am assiging to variable and then using that variable in if
but giving false value even if exist

Hi @Mathkar_kunal

Since your variable is already Boolean, the IF can directly use the variable name. Using = True is unnecessary and sometimes leads to wrong evaluations if typed incorrectly. Just write JiraSoftwareUsersGroupExist in the IF condition.

you will get the result

getting this error

Can you please try this -

groupExists = Extractdatatable.AsEnumerable().Any(Function(r) r(“Group name”).ToString().Split({vbCrLf, vbLf, vbCr}, StringSplitOptions.RemoveEmptyEntries).Any(Function(g) g.Trim().Equals(“jira-software-users”, StringComparison.OrdinalIgnoreCase)))

tryed that as well but still same issue

when i am trying to check using current row, it is giving all list at once may be that is the issue


@Mathkar_kunal Yes you are right

Pleas try this condition in ‘IF’ it helps you to check within a multiple items separated by line breaks for a same row

ExtractDataTable.AsEnumerable().Any(Function(row) row(“Group name”).ToString.Split({Environment.NewLine, vbLf, vbCr}, StringSplitOptions.RemoveEmptyEntries).Any(Function(g) g.Trim.Equals(“jira-software-users”, StringComparison.OrdinalIgnoreCase)))

1 Like

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