Generate Data Table - Specify Data Types - Round 2

Hi UiPath Devs!

I am doing the same thing as has been described in a post from one year ago and I really need to modify the column types because when I use AutoDetect Types it basically corrupts the data by stripping away leading zeros.

I have through extensive google-ing found out that the most recommended solution seems to be to:

  1. Generate datatable A
  2. Clone to a new datatable B
  3. Modify columns in datatable B (empty schema) as needed
  4. Loop through and add rows from A to B

This is probably fine for relatively small amount of data but adds a considerable time penalty to the processing when the data gets bigger.

Is there any plan to extend the Generate Data Table activity in such a way that the data types can be set (schema defined) instead of relying on the AutoDetect - or skipping AutoDetect and relying on the procedure here above?

This is one of the VB sources that complemented this approach…

Having this ability would greatly improve the usefulness of the activity and be in the UiPath spirit of things :slight_smile:

Hi,
Do you have sample input file for us? I’m not sure I understood what you try to do

@fjalar

I am importing a CVS file which I fetch from a web service with the following format:

person_id | name | address| postal_code | city| date_of_record
“0903774159” | “John Johnsson” | “Wallstreet 24” | “10201”| “Reykjavík” | “2016-11-18”

creating a UiPath (VB) datatable object to be inserted into a database.

Now what happens when I use AutoDetect Column Type is this

The leading zero in the first column has been truncated. So, that is not good and at this point the data is corrupted compared to the original data in the CSV file. The detection here is “technically” right, this is a big integer, but should not be interpreted as such, truncating leading zeros. The other data types detected are quite fine.

At this point I tried to modify the type after the fact, and found out that it is not possible as explained here. But that didn’t help with the fact I still neede my zeros back. So I disabled the AutoDetection and got this

Now I have my zeros back but I need to format the data types somehow. And the process for that was recommended in few places and is in my original post.

So I basically need a way to tell the Generate Data Table activity what types I want for my columns so I don’t have to jump through hoops in fixing the data type for this one column.

So that is where I am at now…

1 Like

I think you did good job so far, I not really familiar with this auto detect ( if you figure this out different way I think it is better to continue that way) .

From documentation : * Input - Specifies the source of the unstructured data that is to be converted into a table. This field supports only String variables.

If you need more help please feel free to ask here or PM me :slight_smile:

Best regards

1 Like

@fjalar Do not use AutoDetect Column Type in Generate datatable, By Default it is String and It is Good. But if you want to Change the Datatype of Some Columns, you can do so After Generate Datatable Activity using Change Column Datatype Activity

Try this and let us know if it meets your requirement.

1 Like

So this works like a charm and is basically saving my sanity! I was very close to diving into developing my own Activity…

I actually came across this yesterday but I didn’t figure fast enough out how to use it :expressionless: Lesson learned there also.

Thanks a lot!

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.