Hi Team
Need to extract depends upon Service Launch priority only ( If same TADIG have multiple, select highest one. (5G NSA → LTE → GPRS)
Input:
Output:
Thanks
Shaik
Hi Team
Need to extract depends upon Service Launch priority only ( If same TADIG have multiple, select highest one. (5G NSA → LTE → GPRS)
Input:
Output:
Thanks
Shaik
=> Use Read Range Workbook
Assign Activity 1 -> priorityDict = New Dictionary(Of String, Integer) From {
{"5G NSA", 1},
{"LTE", 2},
{"GPRS", 3}}
Assign Activity 2 -> dt_Output = dt_Input.Clone
Assign Activity 3 -> dt_Output = (From g In dt_Input.AsEnumerable()
Group g By TADIG = g.Field(Of String)("TADIG") Into Group
Let bestRow = Group.OrderBy(Function(r) priorityDict(r.Field(Of String)("Service Launch").Trim())).First()
Select bestRow).CopyToDataTable()
Variable Datatype:

=> Write Range Workbook dt_Output back to excel.
XAML:
Sequence2.xaml (8.8 KB)
Hope it helps!!
Hi @Parvathy
If same TADIG contains high priority list then it will pick all rows only one row?
Input:
I need all high priority list from same TADIG but your code picking only one row
can you update and share please
Thanks
Shaik
Change the LINQ as below:
dt_Output = (From row In dt_Input.AsEnumerable()
Group row By TADIG = row.Field(Of String)("TADIG") Into GroupRows = Group
Let maxPriority = GroupRows.Min(Function(r) priorityDict(r.Field(Of String)("Service Launch").Trim()))
From r In GroupRows
Where priorityDict(r.Field(Of String)("Service Launch").Trim()) = maxPriority
Select r).CopyToDataTable()
Hope it helps!!
Hi @Parvathy
Getting error like , Assign: The given key was not present in the dictionary.
Please check
Thanks
Shaik
Hi @
Assign Activity 1 -> priorityDict = New Dictionary(Of String, Integer) From {
{"5G NSA", 1},
{"LTE", 2},
{"GPRS", 3}}
Assign Activity 2 -> dt_Output = dt_Input.Clone
Assign Activity 3 -> dt_Output = (From row In dt_Input.AsEnumerable()
Group row By TADIG = row.Field(Of String)("TADIG") Into GroupRows = Group
Let maxPriority = GroupRows.Min(Function(r) priorityDict(r.Field(Of String)("Service Launch").Trim()))
From r In GroupRows
Where priorityDict(r.Field(Of String)("Service Launch").Trim()) = maxPriority
Select r).CopyToDataTable()
Check the workflow for better understanding.
Sequence2.xaml (9.3 KB)
Hope it helps!!
getting same error please help
You source data may contains some extra Services that does not exists in you defined dictionary, in this case you have to define the priority of all the Services in the dictionary first.
@Parvathy not changed I just copy code from your workflow and paste but it’s getting same error
The same code is working fine at my end, can you share the xaml so that I can resolve.
Regards
The workflow you have sent works fine at my end, can you please send the excel you’re working with, I will check with that.
Regards
Just give all your Service Launch names in priorityDict according to your Priority and try running the code. It should work.
priorityDict = New Dictionary(Of String, Integer) From {
{"5G NSA", 1},
{"VoLTE", 2},
{"LTE", 3},
{"GPRS", 4}
}
I have added VoLTE at Priority 2 change according to yours.
Regards