How to Convert string to int32 in Datatable

I am extracting pdf details and write it to one excel file. I want to assign a quantity column as int32 datatype in the build datatable activity. I have to write headers as well in the same data table. But for the quantity column, It only accepts int in headers. I want to write the “Invoice_Quantity” text in that header.
Kindly guide me to fix this issue.
@Palaniyappan @Lahiru.Fernando @lakshman

2 Likes

In build datatable change the column data type as “String”.
If your string is of numbers then it can be converted to int type.

@Kalees9486 You cannot Convert “Invoice_Quantiity” into Integer as it is not a Number :sweat_smile:
Can you Exclude writing the Headers into the Datatable as i feel you are already providing using Build Datatable Activity?

1 Like

The process is; If any items repeat the same we need to group the Item Description with Sum of Quantity. When i assign as String I am not able to sum the quantity values. That’s why I assigned as INT type in the data table.
@Manish540

When I exclude the headers, it shows empty headers in the excel file.I want headers in run time itself.
@supermanPunch

@Kalees9486 Are the headers already known or is it dynamic?

Already Known. When we triggered the BOT the excel files are generated. Means run time itself the headers are added to the excel file.
@supermanPunch

@Kalees9486 Can you Exclude the Headers while Extracting :sweat_smile: , since it is already Known, you can Name the headers in Build Datatable as you want

The Error was thrown in that Build Datatable only.
@supermanPunch

@Kalees9486 Can you show us the Screenshot of the Build Datatable Activity ? Also the Screenshot of the Values that are Extracted if Possible :’

I have attached Screenshot of Build Datatable FYI,

Capture

@Kalees9486 Why do you want to Add the Header values as row values ?

The same as shown in that image.“Inv_Quantity” text.
@supermanPunch

You can’t add a string value to a int column in build datatable.

@Kalees9486 Can you Remove the First row Added and Check your Workflow? :sweat_smile:

I will try. But i need that header.
@supermanPunch

Yeah. Any other way to add string headers. Or any suggestion to group the Item Description column?
@Manish540

@Kalees9486 Actually Your Build Datatable has Headers with 1 row :sweat_smile:, You need to just Keep the Headers with the Name you want the Headers to be

1 Like

Make the column data type as String in build datatable and while using the values use
Sum(int variable) = Sum+Convert.toInt32(row(“ColumnName”).Tostring) to get the sum of that column.

1 Like

And as @supermanPunch Remove the first row.