Datatable variable type problem

Hi,

I have used build datatable activity. Columns are string and int32 type.
I have a chapter of text and I have used split and assign activities to store the values I want.
Some of them are text and some numbers.

What is the best way to move those to the datatable?

Currently I have created a variable system.string to first collect all the items together.
And then I have used Add data row activity.

But by doing this, all those variables that are numbers are converted to text.
How to first convert those to numbers when splitting the original text and then add those to the datatable as numbers as well.

Thank you.

Hey!

We can store as string after storing the data type to string we can convert those data to int

Cint(StrNumber)

The above expression will convert the string to int

Try this and let me know

Regards,
NaNi

Hi,

How did you check it’s text?
If you checked it with excel, can you try to use not Workbook-WriteRange activity but WriteRange activity (with Excel Application Scope) or WriteRangeX activity (with UseExcelFile activity)?

Regards,

Hi,

Not sure what happened, but now excel recognizes those as values.
This is, however, only case when I first create the file.

When, I after the first run need to append more information, then excel recognizes those as text.
How to solve this?

Hi,

I have a write range in excel application scope. That is working fine and excel regocnizes data types. Problmes come when I need to append more rows to the same file. Then those are shown in Excel as text.

Adding to previous:

Now, when I try to append the new information to the excel that contains data in correct form, nothing happens. Write range works just fine.

How to solve this?

Hello @Topias_Stromberg1

Here it would be better if you can keep a excel template with the predefined formats to the columns.

Then use write range activity. It will write the data based on the format which you have declared in the excel.

Thanks