Adding Rows containing currency


I have a variable that contains currency as below, and if I want to create a new variable that contains the total of the existing variables, what is the code?

Is there Separate variables for all the amounts?
And if it has one how is it storing all the amounts Please share screenshot?

no, just variabel to save this amount like this


Amount=(code like the pic)

  1. Create one int32 variable of Transaction_amount_Total with Setting Default value to 0.
    2.Inside for each loop use assign activity Transaction_amount_Total=Transaction_Amount_Total+cdbl(mappingRow2(“Transaction Amount”).ToString)

Hope it helps.

Regards,
Saloni

oke let me try

Add System.Globalization to the imports (imports panel next to the Variable Panel)

Assign activity
LHS: totalTA | Int32
RHS:

(From d in YourDataTableVar.AsEnumerable
Let ci = New System.Globalization.CultureInfo("de-DE")
Let a = d("Transaction Amount").toString.Trim
Where int32.TryParse( a ,NumberStyles.Any, new CultureInfo("de-DE"), nothing )
Select v = int32.Parse(a,NumberStyles.Any,ci)).Sum(Function (x) x)

feel free to adopt the culture info and the datatype (e.g. shift to Double)

In case of trouble, same techniques for analyzing can be applied as similiar is described here for date time conversion issues

:ambulance: :sos: [FirstAid] Datatable: Debug & Analysis invalid DateTime Strings / String to DateTime Parsing Issues - News / Tutorials - UiPath Community Forum


how to setting default value to 0 ?

thx for your answer,
umm what mean of RHS and LHS? and what activity used in studio?

From variables Panel Which is located at bottom in Uipath Studio.

grafik


error message : option strict…

@Ridwan_Satrio1 I think there is misplaced characters in amount means instead of 4.680.000,00 it should be like 4,680,000.00 Right?

but the excel input file given in this case is like that. So, I’m having a hard time finding out how to add up the rows, what’s more, there’s a (-) sign in one of the numbers

as several options were suggested, which one did you tried and what was working or not working.

About the differen local number format following approach should work
grafik

umm im so sorry but i dont understand what mean of ci, a, d, v and “de-DE” and x in RHS

Create a variable:
grafik

Use an assign activity done as here
grafik

And replace YourDataTableVar with the variable name of you datatable

it is using LINQ within the statement, we do use these like local variables
[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum

OR

As also mentioned you can implement it within a for each row approach and parsing the string into an integer was mentioned here:


how to fix it? can help me again?

start analysis by using a single assign activity. Bring it out from the muliple assign.

okey i got it, and how about it?

set a breakpoint on the failling assign activity
debug and get paused
open immediate panel and type in:
dt_jurnal.Rows(0)(“Transaction Amount”).toString

we want to check the value within the datatable

Maybe the sum exceeds the maximum value of an int32 and we will change the datatype. But lets check out first the result from analysis above