Deleting default values in table, changing delimiter

My question is how can i delete a defalut row from datascraping that indicates columns “Column-0, Column-1” etc. Basically its the first row of every datascrape output. I tryed to delete row “0” but it deletes first row of scraped value and not the default.
Also datascraping aumatically saves data from table with coma as a delimiter, can i change the default delimiter from coma to semicolon?
And last question - how can i delete a column if at least one row in this column is empty?

Hi @onlywaydie_tim

Could you clarify one thing for me? Are you outputting your data table with an Output Data Table activity?
If so, could you instead use a Write Range activity to save the resulting Data Table to a file and see the result?
Please use the property Add Headers for that as well.

I broke down your questions and tried to answered them below :slight_smile:

  1. How to delete the first row with column names
    It is in not a row of data, but rather simple column names. For example, if you will use a For Each Row activity to iterate through every row of your Data Table, it will not iterate through the ‘first’ row of column names.
    This is why your Remove Data Row activity deletes the first row of the actual data.
    What you can do instead is to simply rename your column names, a simple Assign activity will do the trick:
    yourDataTable.Columns(0).ColumnName = “newColumnName”

  2. Also datascraping aumatically saves data from table with coma as a delimiter, can i change the default delimiter from coma to semicolon?
    The Data Scraping saves the output to a Data Table. This means that the structure pretty much resembles how an Excel file would look like - with Rows and Columns.
    However, if you use the Output Data Table activity, it will display in your console together with column names and commas as delimiter. This is only for displaying it in the console.
    If you need a different format of displaying it, you could create a separate sequence that will save your Data Table with a desired format (that is a bit more work).

  3. And last question - how can i delete a column if at least one row in this column is empty?
    For this one you can use a method of Data Tables to Select all Columns where all rows are non-empty. This can also be done with an Assign activity:
    filteredDataTable = originalDataTable.Select("[Name of the first column]<>'' AND [Name of the second column]<>''").CopyToDataTable()
    Quick disclaimer - I am currently struggling to understand why this Select returns the rows in the reverse order:
    image
    @ClaytonM Could you maybe help here? It is the first time it happened to me that .Select returns the rows in the exact reversed order; I am a bit confused as to why.

See attached xaml project for reference :slight_smile:
SelectFromDataTable.zip (10.8 KB)

So I thought this was weird too.
First thing I tried was using an AsEnumerable method instead (which is how I do it normally).

That worked.

Then, I was thinking what if the Select method you are using is also sorting the table. So I added a “v” to start the “more text” value, and bingo bango, it was sorting it.

So the answer to your question is that it sorts the table by the first column.

1 Like

Thank you for answers. About coma - when i try to save data output in csv file, it saves the whole information in a single cell, becouse my excel do not recognize coma as table delimiter, thats why im asking about the way to change the default.

Then I think you can customize it in the Properties of the activity:
image

But it fact, if you open the CSV file with Notepad, it will be a line of data per row separated with commas (that is how CSV files look like, simple text files).

Excel is simply displaying them with columns for user’s convenience, and I suppose you could just as well convert the rows to columns within Excel.

1 Like

Hi @loginerror,

Do you know, by any chance, if I can to change column name given by default after data scraping as here:

Thanks

Hi @MigT

The correct syntax to do it was mentioned earlier in this topic :slight_smile: See below the simple assignment for the Assign activity:

yourDataTable.Columns(0).ColumnName = “newColumnName”

Columns(0) is the index of the current column, the first one from the left having 0, the second one 1 and so on :slight_smile:

2 Likes

Thank you so much @loginerror :wink:

Did you know I could resolve this last problem:

To summarize I should to remove one paragraphe in the web application window according to a condition. So I extract the text in a variable and then the paragraph of interest in an other variable.
If the condition is not respected the paragraph should be remove so I try these cases with Assign activity:
TextVariable = TextVariable.Replace(ParagraphVariable,“”)
NewVariabvle = TextVariable.Replace(ParagraphVariable,“”)
NewVariabvle = TextVariable.Remove(ParagraphVariable,“”)

However, that change my variable but not the text inside the web application window.

By looking at the issue really briefly, I understand that you:

  1. Read the variable from the page
  2. Modify the variable in the memory

It seems that you are missing the third step:
3. Write the modified variable back to the page
This can be achieved by the Type Into activity.

Am I mistaken here? :slight_smile: