Facing issue while converting to decimal from string.
Used- ‘accSys’ as ‘String’ to store the values from the excel.
‘accSys1_Sum’ as ‘decimal’ or ‘double’.
accSys1_Sum = accSys1_Sum+Convert.ToDecimal(accSys.Replace(" “,”"))
Welcome to UiPath community
Fine
–what is the value of accSys and
–make sure that you have a default value for accSys1_Sum as 0
–what is replaced here in accSys
Kindly share this detail buddy
this can be resolved
Cheers @AryanSingh
Thanks
–what is the value of accSys :- row(“Example”).ToString
–make sure that you have a default value for accSys1_Sum as 0 : it has
–what is replaced here in accSys :- this one resolved
Just to confirm one thing, if the column name in “row(“Example”).ToString” has spaces between the words. Then, should it be in square brackets @Palaniyappan @amarasto
no buddy not necesssary, we are mentioning it as string, within double quotes
so no need of square brackets
Fine what is the value of row(“Example”).ToString
only then we can get to know why this error has occurred and this occurred because the input pass is not right format buddy
kindly let know what is replaced as well
if we are using this replace empty space that lies either in front or back of the string we can simply use Trim method like this accSys1_Sum = accSys1_Sum+Convert.ToDecimal(accSys.ToString.Trim) where accSys1_Sum should be type Decimal or Double or atleast a int32
Cheers @AryanSingh
No that is only required in case of datatable select filter but if you are getting the row inside the foreach row then there is no need to add the brackets there.
Fine
this will work all except -1291.81
because it has a - in front and thats what showing error
to rectify this
use a if condition like this before assigning value to the accSys1_Sum
like this in if condition row(“Invoice Excl Vat Amt”).ToString.Contains(“-”)
if this gets satisfied it will go to THEN part where we have mention the assign activity like this accSys1_Sum = accSys1_Sum-Convert.ToDecimal(accSys.ToString.Replace(“-”,“”))
or this not getting satisfied it will go to ELSE part where we can mention the assign activity like this accSys1_Sum = accSys1_Sum+Convert.ToDecimal(accSys.ToString.Trim)
why this equal to buddy
what is the validation made here
or
are we tryng to use select method and copy the filtered data made by select method, back to the ConsolidatedDT
if so it should be mentioned like this in assign activity buddy ConsolidatedDT = ConsolidatedDT.Select(“[Account Name] = ‘xyz’ and [Bill Account Name] = ‘xyz (PTY) LTD’”).CopyToDataTable()
actually trying to temporarily filter one column and then apply one more filter in other column [like a sub category] and then getting the sum of the subcategory invoice. Bulk of data to filter.
if i save the filtered data in the dataTable then wud be too many datatables.
Should i keep the main DataTable seperate and manipulate the dataTable seperately for each case using for invoke.
Fine
For that first filter that data and assign the filtered data back to the same table as mentioned here
And try to sum the value of the subcategory invoice by passing the above datatable variable as input to the for each row loop
–inside the loop use a assign activity like this out_sum_value = out_sum_value + Convert.ToDecimal(row(“yoursubcategoryinvoicecolumnname”).ToString)
where out_sum_value is a variable of type decimal with default value of 0 defined in te variable panel
Fine use another datatable varaible on left side not the same
That was my fault, typo mistake
create a variable named FinalDt of type datatable and put the default value as new System.Data.Datatable
Cheers @AryanSingh
Fine can i have a view on the value in the right side of the assign activity if possible
there is a constant used under the name ACCSYS
is any such used in the value in the right side
Cheers @AryanSingh