How to get current date count row by row

Hi Team,

I want to count of each row current date count if count is even then condition is true or count is 0 also true else false

Please anyone help me for this.

Input sheet:

If date count is
XXX row current date count =2
YYY row current date count =3
ZZZ row current date count =3
AAA row current date count =4

In above even count is there so True

if date count
XXX row current date count =2
YYY row current date count =1
ZZZ row current date count =3
AAA row current date count =4
NO even count is there in above condition so False

Regards,
Raja G

1 Like

@Raja.G
Hello.

Hi @Raja.G
You can follow the below steps

  1. Try to read data from excel using read range activity.
  2. Use for each row loop for iterting through each element name the variable as CurrentRow.
  3. Get the column count in your case the column starts with C, so we can skip the first two column.
    you can do like this = considering data table variable as dt_data
    dt_data.Columns.Count -2
    store this in one variable say columnCount, because now we are going to place one more loop inside the for each row loop
  4. Now after calculating the columns, place the while loop and create a variable as an index like whileLoopIndex which will loop through the remaining column. The initial value of this index will be 1 because we have to skip the starting two cols. To start reading the values from the C column you have to read the value like this str_date = CurrentRow.ItemArray(whileLoopIndex).ToString.Split(new(){" "},StringSplitOptions.None)(1).ToString()
    Assuming CurrentRow is the variable in for each row loop
    this will give you the date from the cell.
  5. After this you can place your condition for matching with currentDate like this
    str_date= DateTime.Now.ToString("MM.dd.yy")
    if the condition matches then you can increment the counter which will indicate your current date count.

let me know if any confusion

Hope this helps

1 Like

Hi @FIROZ_RANGREZ

I tried i have confusion so i attached xmal below please check and send me correct solution

TestExcel.zip (8.4 KB)

Hi @Raja.G

Can u share input excel file here.

Hi Suraj,

Book1.xlsx (164.6 KB)

Hi Team,

My expectation is below link only

I got least count but even count is present always pick first item that i dont want , i want if even count is there pick anyone person name randomly

Hi @Raja.G

Check this workflow.
DateCount.xaml (11.0 KB)

Hope this helps

2 Likes

Hi @Raja.G

Please change this in the code and check
image

Updated Sample Workflow
DateCount.xaml (11.0 KB)

Hi @Suraj_B_Shetty ,

Not worked

Came true , this data is false only expected

@Raja.G

In the file there total are 12 current date in the table . It should be true right?

Hi @Suraj_B_Shetty ,

XXX–2
YYY–3
ZZZ–4
AAA–1
False
XXX–2
YYY–3
ZZZ–3
AAA–1
True

Hi @Raja.G

If you are looking for row wise count then check this updated workflow.
DateCount.xaml (12.4 KB)

It give this output . Then you can check the codition based on “counter status” column.

Hi @Suraj_B_Shetty ,

I am not looking this , i want all row result based set condition

Hi @Suraj_B_Shetty ,

My Actual Expectations this only

Please look above requirement that only i want

Please anyone help me for this

Hi @Raja.G
Check this workflow. It returns the person name with least current date count
DateCount.xaml (13.0 KB)

Hope this helps

Hi @Suraj_B_Shetty ,

Yes worked ,
but If date count is zero of all the row na, it will give always came first person, i want anyone person randomly
and status =On

This is only my main issue

Hi @Raja.G

If date count is 0 for all row then you want check status= “On”?
In the above file if date count is 0 for all row then it should return yyy as output based on status=“On”
Please confirm

Yes correct but i want random so take below excel
Book1.xlsx (165.3 KB)