Error in Workflow

DataTable.xaml (17.0 KB)
Hello
I have done this workflow to find out most sales and least sales region but im facing some issue, can anyone help us to resolve issue

DataTable.xaml (17.6 KB)
Hi,

You missed to convert the value to string in assign activities and also did not close the string format function. try run and let us know if you face any issues.


i need to change variable type to double, showing error

Hi @Tejaswini_Yadav

Please try Changing sum_East,Sum_Central,Sum_Central from string to double

and also close string.format with ) as @kirankumar.mahanthi1 suggested.

Thanks

I changed error

@Tejaswini_Yadav what error you ar getting?

Thanks


when i changed variable to Double getting error like this

@Tejaswini_Yadav convert only these three variables to double sum_East,Sum_Central,Sum_West

Rest all you can keep as it is.

Like in the screenshot I shared earlier.

Thanks

1 Like

Sum_East + Convert.ToDouble(Row.Item(“Total”))
Sum_West + Convert.ToDouble(Row.Item(“Total”))

String.Format(“The least sales is by region (0). The total sales in this region is (1).”,SortedDT1.Rows(0).Item(0).ToString, SortedDT1.Rows(0).Item(1).ToString)

String.Format(“The most sales is by region (0). The total sales in this region is (1).” , SortedDT1.Rows(2).Item(0).ToString, SortedDT1.Rows(2).Item(1).ToString)

Not getting the total sales amount, did this syntax used fine r wat

OrderDate Region Rep Item Units Unit Cost Total
1-6-19 East Jones Pencil 95 1.99 189.05
1-23-19 Central Kivell Binder 50 19.99 999.50
2-9-19 Central Jardine Pencil 36 4.99 179.64
2-26-19 Central Gill Pen 27 19.99 539.73
3-15-19 West Sorvino Pencil 56 2.99 167.44
4-1-19 East Jones Binder 60 4.99 299.40
4-18-19 Central Andrews Pencil 75 1.99 149.25
5-5-19 Central Jardine Pencil 90 4.99 449.10
5-22-19 West Thompson Pencil 32 1.99 63.68
6-8-19 East Jones Binder 60 8.99 539.40
6-25-19 Central Morgan Pencil 90 4.99 449.10
7-12-19 East Howard Binder 29 1.99 57.71
7-29-19 East Parent Binder 81 19.99 1,619.19
8-15-19 East Jones Pencil 35 4.99 174.65
9-1-19 Central Smith Desk 2 125.00 250.00
9-18-19 East Jones Pen Set 16 15.99 255.84
![image 454x341](upload://lrSfXMOypzShrP25OmY6lCEZQIQ.png)

Hi @Tejaswini_Yadav

I have altered the logic, please refer below,

Complete workflow

Input (replace build data table with read range) output - dt1 (data table)

Create one datatable using build data table and give columns region and total. output - dt2 (data table)

Assign

(From dtRow In dt1.AsEnumerable
Group By k = dtRow("Region").ToString.Trim Into grp = Group
Let sum = grp.sum(Function(row) CDbl(row("Total")))
Let arr = New Object(){grp(0)("Region").tostring,sum}
Select dt2.Rows.Add(arr)).copytodatatable.asenumerable.orderby(Function(d) CDbl(d("Total"))).copytodatatable

Message box 1 for least sales

String.Format(“The least sales is by region {0}. The total sales in this region is {1}.”,dt2.Rows(0)("Region").ToString,dt2.Rows(0)("Total").ToString)

Message box 2 for most sales

String.Format(“The Most sales is by region {0}. The total sales in this region is {1}.”,dt2.Rows(dt2.RowCount-1)("Region").ToString,dt2.Rows(dt2.RowCount-1)("Total").ToString)

Output

image

image

Thanks

thank you @prasath_S workflow running properly,
but agenda is it has to extract data from excel file need to display most and least sales.

@Tejaswini_Yadav

Input (replace build data table with read range) output - dt1 (data table

As said in the previous post replace build datatable with read range and read the excel sheet and store it in datatable.

Thanks

@prasath_S thank u resolved, i made changes in syntax bit

@Tejaswini_Yadav glad your issue is resolved, please mark the solution and close the thread so it may be useful to others in the future.

Thanks

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