Hello guys
I need to get the Name for corresponding repeating policy from the sheet (Iam using REFRAMEWORK)
EG
If the transaction item is “P-100-7101-2022-254” it should get the 3 names Like "Saori , Cris etc…
The name is entering in a field by RPA.
And the next transaction item is “P-100-7101-2021-340” it should get the 4 names Like "Z, Cris etc…
@Gokul_Murali
for that you need to pass the datatable argument into the process state and use this expression
string.join(",",dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals("P-100-7101-2022-254”)).Select(Function(a) a(0).ToString.Trim).ToArray)
string.join(",",dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals(in_transactionItem).Select(Function(a) a(0).ToString.Trim).ToArray)
in_transactionItem is the your input argument
AJ_Ask
November 22, 2023, 10:40am
3
Hi @Gokul_Murali
You can use filter datatable activity in this use column name as “Policy Reference” and Value as your in_transactionItem variable then you will get filtered column with the values in Dt_Output datatable
Hope this helps
@Gokul_Murali
yes you can use it in assign activity
output is string datatype
outputstr=string.join(",",dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals(in_transactionItem).Select(Function(a) a(0).ToString.Trim).ToArray)
if you want to get it in an array use this
arr_values=dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals(in_transactionItem).Select(Function(a) a(0).ToString.Trim).ToArray
@Shiva_Nikhil
you don’t get my requirement (Thats not my requirement).
Here when RPA enters 2nd transaction data it is “P-100-7101-2022-254” so it should get all the name with same policy reference
@Gokul_Murali
you will get all the names
check with this once
you can make dynamic by replacing the number with variable or argument
outputstr=string.join(",",dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals("P-100-7101-2022-254”).Select(Function(a) a(0).ToString.Trim).ToArray)
@Shiva_Nikhil
So, you are telling that if there are 5 same policy i will get the corresponding 5 names right.
Iam getting an error like this while using the exprn.
And the datatype is String i used.
@Gokul_Murali
use this in the value expression and outputstr is the sample variable i have used it should be on right
string.join(",",dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals("P-100-7101-2022-254”).Select(Function(a) a(0).ToString.Trim).ToArray)
@Shiva_Nikhil
I have used this expression
arr_values=dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals(in_transactionItem).Select(Function(a) a(0).ToString.Trim).ToArray
–>And made changes like this of string data type
dtTransactionData.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals((in_transactionitem(“Policy Reference”).ToString).Select(Function(a) a(0).ToString.Trim).ToArray
Still iam getting error like this
@Gokul_Murali
you have used extra brackets after equals please check it
it is of array of string
dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals(in_transactionItem("Policy Reference").tostring).Select(Function(a) a(0).ToString.Trim).ToArray
if you use below the datatype is of string
string.join(",",dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals("P-100-7101-2022-254”).Select(Function(a) a(0).ToString.Trim).ToArray)
@Shiva_Nikhil
See still iam getting the same error
@Gokul_Murali
you need to convert it to list
if you are using list of string
dt1.AsEnumerable.where(Function(a) a(1).ToString.trim.Equals(in_transactionItem("Policy Reference").tostring)).Select(Function(a) a(0).ToString.Trim).ToList
@Shiva_Nikhil
I have replaced with a variable called data of datatype string still iam getting the same error
@Gokul_Murali
usually if you want to print the list you need to use this
String.join(",",OutArr)
sanjay3
(Sanjay)
November 23, 2023, 8:55am
17
Hi @Gokul_Murali
Here is how you can implement this logic within the “Process Transaction” state:
’ This is assuming transactionItem is a string containing the policy reference.
’ e.g., transactionItem = “P-100-7101-2022-254”
matchingNames As List(Of String) = dtPolicies.AsEnumerable().
Where(Function(row) row(“Policy Reference”).ToString.Equals(transactionItem.ToString)).
Select(Function(row) row(“Name”).ToString).
Distinct(). ’ Use Distinct if you want to avoid duplicate names.
ToList()
’ Now matchingNames contains all the names for the given policy reference.
’ You would then enter these names one by one into the required field.
system
(system)
Closed
November 26, 2023, 8:56am
18
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.