Log messages for particular data

I am having datatable as Name,Country,Gender and in this gender their are many rows like M & F and now i want to print only the gender value which is having M, i want to print it in log messages

Hey!

Use if condition like this

In for each row data table

CurrentRow("Gender").ToString.Trim.Equal("Male")

In then block use Log message

Log level- INFO
Value- CurrentRow("Gender*).ToString

Regards,
NaNi

both logs not working and mainly after looping it is showing error as gender not in datatable

Hey @prathik_8679

Take a look in the “Locals Panel” to check the Column Name.

Assuming the column is called “Gender”

Then insert a For Each row.
Then insert a log with:
row.item(“Gender”).tostring

Hopefully this helps

Cheers

Steve

Hey!

Instead of columnName give the Column index…

Remember Column index always starts from 0.

ColumnName->Name->0
ColumnName->Country->1
ColumnName->Gender->2

Inside the For each row

Take one if condition

And mention like this

CurrentRow(2).ToString.Trim.Equal("Male")

Now take Log Message

Regards,
NaNi

if want to print the names of gender M through log message

Hey!

After If condition which is mentioned above

In the then part

Use like this

Log Message-

Level-> INFO
Value-> "Name: "+CurrentRow("Name").ToString.Trim

Try this and let me know

Regards,
NaNi

image
i am getting this result but how i need is if i mention the word ‘m’ then i should get all the names of all Males names that is their in datatable

Heyy!

You can use contains also but the thing is

Female also we can have m letter
Male also we can have m letter

Instead of using the contains it’s better to use the Equal in if condition

So if you need all names at a time you should use List.

You need to add the each item to list then you can get the names which is the gender m

OR

No need to use For Each row:

Use Filter DataTable->Input DataTable->Output of ReadRange->Output As->New_Dt

->Keep
ColumnName=“Male”

Take one Output DataTable activity

Provide input Dt as->New_Dt
Output as → Create new string variable

In log Message mention this String variable

Regards,
NaNi

ok i will try and let u know nani

1 Like

finally after trying many trails I got it thanks nani

1 Like

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