How to Remove dynamic rows in from data table below 6787000171 this number

How to Remove dynamic rows from data table always below 6787000171 this reference number.
Rows are always dynamic position below and above .

HI @satish.rathi59

I’ve answered this another similar post please have a look.

The change that you should be doing is that in operation select equals and pass the value/ variable in the filter value.

1 Like

Hi @satish.rathi59 ,

To Remove the rows that come after the mentioned value (6787000171), Follow the below steps
Step 1 : Use a For each row in data table activity to iterate
Step 2 : Create a variable MatchFound(Boolean)- default value false
Step 3 : Place an if inside the for Loop, Condition is the variable MatchFound, Then Part Place Delete Row activity and pass (CurrentRow)
In else part, have an assign activity ,
LHS:
MatchFound
RHS:
IF(CurrentRow(“ColumnName”).ToString = “6787000171”,True,False)

The above should do the trick.

Note that , You need to use the exact row reference used in for each row activity.
mentioned CurrentRow as that is a default notion and the ColumnName should be replaced with the column header where the value can be found.

Hope this helps you out.

Thanks,
Gautham.

Hi @satish.rathi59, you can also use “Lookup Data Table” – it should give you the index of the first occurrence of the value. See screenshots.

hope that helps.

image

Hey @satish.rathi59

I have solved your query,

Read your excel file,

Take one assign activity:

dt_Input = dt_Input.AsEnumerable().TakeWhile(Function(x) Not String.IsNullOrEmpty(x("YourColumnName").ToString.Trim)).CopyToDataTable

That’s it you will get Expected Output…!

Note: In my case bot is reading “#REF!” as Null, you can see in below screenshot of immediate panel, that’s why I have used above LinQ. If in your system it is reading “#REF!” only then use below LinQ in Assign Activity

dt_Input = dt_Input.AsEnumerable().TakeWhile(Function(x) Not x("YourColumnName").ToString.Trim.Contains("#")).CopyToDataTable

Replace Column Name as per your Input File.

Requirements:

Input File:
image

Execution:

You can see in the immediate panel (Input & Output),

Output:

image

Hope above LinQ will resolve your issue!

Regards,
Ajay Mishra