Ellen
(Ellen )
January 2, 2024, 9:05am
1
How to add decimal to the price by finding the length of column value.
feks.
CurrentRow(1) has value = 5000 and I need to add 2 zero so that it shows 50.00.
another example,
CurrentRow(1) has value = 85000 and after adding zero it should be 850.00
I tried every thing… String.format, F2 and other but still no success.
rlgandu
(Rajyalakshmi Gandu)
January 2, 2024, 9:07am
2
@Ellen
Assign Activity:
Left side: newValue (String)
Right side: (Convert.ToDouble(CurrentRow(1).ToString)/100).ToString("F2")
vrdabberu
(Varunraj Dabberu)
January 2, 2024, 9:09am
3
Hi @Ellen
CurrentRow(0)= CurrentRow(0).ToString.Trim().Insert(CurrentRow(0).ToString.Trim.Length-2,".")
Regards
mkankatala
(Mahesh Kankatala)
January 2, 2024, 9:15am
4
Hi @Ellen
→ Read the excel by using the Read range workbook activity and store it in a datatable.
→ Use for each row in datatable activity to iterate the rows in the datatable.
→ Inside for each insert the assign activity
- Assign -> Currentrow(1) = (Decimal.Parse(CurrentRow(1).ToString()) / 100).ToString(".00")
Check the below image for better understanding,
Input →
Output →
Hope it helps!!
lrtetala
(Lakshman Reddy)
January 2, 2024, 9:20am
5
Hi @Ellen
Try this
(From row In dt_Input.AsEnumerable() Select dt_Input.Clone().Rows.Add((CInt(CDec(row.Field(Of Double)("Amount")) / 100)).ToString("F2"))).CopyToDataTable()
Hope this helps!!
Ellen
(Ellen )
January 2, 2024, 9:22am
6
I have used:
CurrentRow(1).ToString.Insert(CurrentRow(1).ToString.Length-2,“.”)
Its working… Thanks for the help.
system
(system)
Closed
January 5, 2024, 9:22am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.