Clear Datatable not working

i try to clear the datatable except header as it does not work.



lets go step by step:
Read range,

  • add headers setting True is taking first row as ColNames - Or False, all rows are datarows
  • clear data table, clears the data, but keep the col names
  • write range add headers = true: writes the colnames , =false then it should be empty

check the add geaders flag

if its not working as expected give us more details on the issue

1 Like

i tried as it does not work, please check if we are missing anything here.

cleartable readrange writerange

here you can specify the “is not working” more clear"

but when on write range add headers is activated then it is writing the column names as I mentioned above

@raj_nadar After the read range, add a write line that is “dt1.rows.count.tostring”

After the clear data table add the same write line again.

Make sure the first one has rows and the second one does not.

Also, make sure you are using the same datatable variable for the read range, clear data table, and write range activities

@Dave i used the same datatable as clearDT1 but its not clearing the rows except headers.

So the read range is saving the datatable to the variable named “ClearDT1” correct? And the clear datatable is clearing the variable named “ClearDT1” correct?

What was the output shown for the 2 write lines?

Writeline output not mentioned anything if i mentioned outputDT getting error.

When you use the write line activity, it writes to the “output” section within studio. This is where all the log messages, etc go when running a program through studio. It should show an integer in grey in the “output” window of studio when you run the program.

I am in the community edition i do not use currently for studio version and not sure how it was shown.

please see the blue circle. When you run your activity, you can see any write line activities in the same spot. Please tell me what the outputs are for the 2 write lines after you run your process

Hi @Raj_Nadar,

If you want to clear the datatable along with headers.

Take a assign and pass value Nothing to the DT.

DatatableObj= Nothing


1 Like

Hi @mukeshkala - we would require headers constant except we need to remove from table.

I dont know if i fully understand you, but i will state this: There cannot be a DataTable without headers.

i have datatable… i want to read range and remove the table except 1st row(header). suggest

It means clear datatable except headers.

That is what Clear Data Table do, remove all rows… It is not possible that it is not working, unless you have some confusion with your workflow that you cant see now…

Not sure what was the issue i placed complete screenshot

@Raj_Nadar I have asked multiple times what happens when you use the write line activities in the locations I suggested. If you provide us with those results it would help us troubleshoot to determine where the error is occurring

We are not getting any troubleshoot error, attached is project for view. pls help me on the same.

Test.xlsx (11.0 KB) FLM.xaml (6.3 KB)